{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}/Users/garlicka/Desktop/LAP_PSRM_Replication/Replication Log.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res} 6 Aug 2020, 11:41:02

{com}. do "/var/folders/48/w4xrc9rj3xn1jqm9rx8h3pjhj3hlq1/T//SD02973.000000"
{txt}
{com}. do "LAP_Replication_1_Table_1.do"
{txt}
{com}. //1. set this to the desired path
. cd "~/Desktop/LAP_PSRM_Replication/"
{res}/Users/garlicka/Desktop/LAP_PSRM_Replication
{txt}
{com}. 
. //2. Import the core replication file
. use "LAP_Replication_COOHWIUS.dta", clear
{txt}
{com}. 
. //3. Limit the sample to the key years
. drop if year > 2016
{txt}(77,559 observations deleted)

{com}. drop if year > 2014 & state == "wi"
{txt}(2,544 observations deleted)

{com}. 
. //4. Find which bills have votes on them
. gen votes = . 
{txt}(52,154 missing values generated)

{com}. replace votes = 1 if party_diff != . 
{txt}(37,357 real changes made)

{com}. 
. //5. Reduce each bill to a single line
. collapse (sum) votes (min) year, by(orgs* bill_id session state)
{txt}
{com}. 
. //6. Only keep the bills that had a passage vote
. drop if votes == 0
{txt}(3,324 observations deleted)

{com}. 
. //7. Calculate how many bills and votes, and the average number of groups lobbying on a bill in each session by state. 
. gen bills = 1 
{txt}
{com}. egen average_groups = rowtotal(orgs*)
{txt}
{com}. collapse (sum) votes bills (mean) average_g (min) year, by(state sess)
{txt}
{com}. 
. //8. The following code helps the data fit into a latex table
. forvalues i= 1/5{c -(}
{txt}  2{com}. gen amp`i' = "&"
{txt}  3{com}. {c )-}
{txt}
{com}. format aver %12.1f
{txt}
{com}. format bills votes %12.0fc
{txt}
{com}. gen ender = "\\"
{txt}
{com}. order state amp1 sess amp2 year amp3 bills amp4 votes amp5 aver ender
{txt}
{com}. 
. //9. Change the labels on the data.
. replace session = session+"th" if state == "us" | state == "oh"
{txt}(10 real changes made)

{com}. //drop the repetitive state labels
. egen counter = rank(year), by(state) unique
{txt}
{com}. replace state = "" if counter > 1
{txt}(15 real changes made)

{com}. drop counter
{txt}
{com}. //clean up the labels
. replace session = subinstr(session,"Regular Session","Reg.",.)
{txt}(3 real changes made)

{com}. 
. //10. Create Table 1
. list state session year bills votes average_groups
{txt}
     {c TLC}{hline 7}{c -}{hline 11}{c -}{hline 6}{c -}{hline 7}{c -}{hline 7}{c -}{hline 10}{c TRC}
     {c |} {res}state     session   year   bills   votes   averag~s {txt}{c |}
     {c LT}{hline 7}{c -}{hline 11}{c -}{hline 6}{c -}{hline 7}{c -}{hline 7}{c -}{hline 10}{c RT}
  1. {c |} {res}   co       2011A   2011     603   3,641       17.8 {txt}{c |}
  2. {c |} {res}            2012A   2012     566   3,387       18.3 {txt}{c |}
  3. {c |} {res}            2013A   2013     699   5,693       18.4 {txt}{c |}
  4. {c |} {res}            2014A   2014     701   4,457       19.3 {txt}{c |}
  5. {c |} {res}            2015A   2015     754   3,860       19.8 {txt}{c |}
     {c LT}{hline 7}{c -}{hline 11}{c -}{hline 6}{c -}{hline 7}{c -}{hline 7}{c -}{hline 10}{c RT}
  6. {c |} {res}            2016A   2016     768   4,840       16.8 {txt}{c |}
  7. {c |} {res}   oh       129th   2012     324   1,087       23.1 {txt}{c |}
  8. {c |} {res}            130th   2014     397   1,095       22.4 {txt}{c |}
  9. {c |} {res}   us       106th   1999     156     646        3.5 {txt}{c |}
 10. {c |} {res}            107th   2001     160     592        8.8 {txt}{c |}
     {c LT}{hline 7}{c -}{hline 11}{c -}{hline 6}{c -}{hline 7}{c -}{hline 7}{c -}{hline 10}{c RT}
 11. {c |} {res}            108th   2003     198     735       13.0 {txt}{c |}
 12. {c |} {res}            109th   2005     239     886       47.5 {txt}{c |}
 13. {c |} {res}            110th   2007     415   1,251       74.4 {txt}{c |}
 14. {c |} {res}            111th   2009     349   1,040      100.5 {txt}{c |}
 15. {c |} {res}            112th   2011     300   1,367       90.2 {txt}{c |}
     {c LT}{hline 7}{c -}{hline 11}{c -}{hline 6}{c -}{hline 7}{c -}{hline 7}{c -}{hline 10}{c RT}
 16. {c |} {res}            113th   2013     299     903       72.2 {txt}{c |}
 17. {c |} {res}   wi   2009 Reg.   2009     260     812        9.4 {txt}{c |}
 18. {c |} {res}        2011 Reg.   2011     242     814        8.3 {txt}{c |}
 19. {c |} {res}        2013 Reg.   2013     167     251        8.2 {txt}{c |}
     {c BLC}{hline 7}{c -}{hline 11}{c -}{hline 6}{c -}{hline 7}{c -}{hline 7}{c -}{hline 10}{c BRC}

{com}. 
{txt}end of do-file

{com}. 
{txt}end of do-file

{com}. do "/var/folders/48/w4xrc9rj3xn1jqm9rx8h3pjhj3hlq1/T//SD02973.000000"
{txt}
{com}. do "LAP_Replication_2_Tables_2+3.do"
{txt}
{com}. //1. set this to the desired path
. cd "~/Desktop/LAP_PSRM_Replication/"
{res}/Users/garlicka/Desktop/LAP_PSRM_Replication
{txt}
{com}. 
. //2. Import the core replication file
. use "LAP_Replication_COOHWIUS.dta", clear
{txt}
{com}. 
. //3. Transform the Independent variables (no. of groups lobbying on a bill by type)
. // Change missing to zero, use the Laplace smoothing procedure (add one), and take the natural log of the number
. 
. local group_types "G B N"
{txt}
{com}. 
. foreach g of local group_types{c -(}
{txt}  2{com}. gen lorgs_`g' = log(orgs_`g'+1)
{txt}  3{com}. replace porgs_`g'_O = 0 if porgs_`g'_O == . 
{txt}  4{com}. replace porgs_`g'_S = 0 if porgs_`g'_S == . 
{txt}  5{com}. gen lporgs_`g'_opp = log(porgs_`g'_O+1)
{txt}  6{com}. gen lporgs_`g'_supp = log(porgs_`g'_S+1)
{txt}  7{com}. {c )-}
{txt}(35,403 missing values generated)
(116,892 real changes made)
(108,433 real changes made)
(35,403 missing values generated)
(116,595 real changes made)
(107,928 real changes made)
(35,403 missing values generated)
(108,833 real changes made)
(93,671 real changes made)

{com}. 
. //4. Transform the average sponsor ideal point to a measure of extremity.
. // Multiple liberal (negative) scores by negative one, so it resembles an absolute value, without assuming zero is the midpoint)
. gen spon_mean_ext = spon_mean 
{txt}(37,235 missing values generated)

{com}. replace spon_mean_ext = spon_mean * -1 if spon_mean < 0
{txt}(41,707 real changes made)

{com}. 
. 
. //5. Mark any bill that has an article about it as salient
. gen salient =  0
{txt}
{com}. replace salient = 1 if articles > 0 
{txt}(52,849 real changes made)

{com}. 
. 
. //6. Table one, first set up controls 
. //make sure your machine has installed the reghdfe
. //if not run the following code:
. //ssc install reghdfe
. 
. //also make sure you have the ESTOUT package installed to make tables
. //if not, run the following code:
. //ssc install estout
. 
. 
. global lpdd_controls_floor "salient spon_mean_ext if sg_vote < 4 "
{txt}
{com}. global lpdd_controls_comm "salient spon_mean_ext if sg_vote >= 4 "
{txt}
{com}. global lppd_absorb ", absorb(senate year sg_vote) cluster(bill_id)"
{txt}
{com}. global lppd_absorb2 ", absorb(senate year sg_vote papmajor) cluster(bill_id)"
{txt}
{com}. 
. 
. //Table 2:
. eststo clear
{txt}
{com}. eststo: reghdfe party_diff lorgs*  $lpdd_controls_floor & state == "us" $lppd_absorb2
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 8 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}     7,411
{txt}Absorbing 4 HDFE groups{col 51}F({res}   5{txt},{res}   2113{txt}){col 67}= {res}     45.39
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0000
{txt}{col 51}R-squared{col 67}= {res}    0.2273
{txt}{col 51}Adj R-squared{col 67}= {res}    0.2229
{txt}{col 51}Within R-sq.{col 67}= {res}    0.0733
{txt}{col 1}Number of clusters ({res}bill_id{txt}) {col 30}= {res}     2,114{txt}{col 51}Root MSE{col 67}= {res}    0.3202

{txt}{ralign 79:(Std. Err. adjusted for {res:2,114} clusters in bill_id)}
{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}    Robust
{col 1}   party_diff{col 15}{c |}      Coef.{col 27}   Std. Err.{col 39}      t{col 47}   P>|t|{col 55}     [95% Con{col 68}f. Interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 6}lorgs_G {c |}{col 15}{res}{space 2}-.0546563{col 27}{space 2} .0077865{col 38}{space 1}   -7.02{col 47}{space 3}0.000{col 55}{space 4}-.0699263{col 68}{space 3}-.0393864
{txt}{space 6}lorgs_B {c |}{col 15}{res}{space 2} .0045233{col 27}{space 2} .0070517{col 38}{space 1}    0.64{col 47}{space 3}0.521{col 55}{space 4}-.0093058{col 68}{space 3} .0183524
{txt}{space 6}lorgs_N {c |}{col 15}{res}{space 2} .0975377{col 27}{space 2} .0094725{col 38}{space 1}   10.30{col 47}{space 3}0.000{col 55}{space 4} .0789612{col 68}{space 3} .1161141
{txt}{space 6}salient {c |}{col 15}{res}{space 2} .0209321{col 27}{space 2}  .017435{col 38}{space 1}    1.20{col 47}{space 3}0.230{col 55}{space 4}-.0132595{col 68}{space 3} .0551236
{txt}spon_mean_ext {c |}{col 15}{res}{space 2} .1528514{col 27}{space 2} .0388945{col 38}{space 1}    3.93{col 47}{space 3}0.000{col 55}{space 4} .0765759{col 68}{space 3} .2291269
{txt}{space 8}_cons {c |}{col 15}{res}{space 2} .2363719{col 27}{space 2} .0252986{col 38}{space 1}    9.34{col 47}{space 3}0.000{col 55}{space 4} .1867591{col 68}{space 3} .2859847
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}      senate{col 14}{c |}{space 1}        2{col 27}{space 1}        0{col 39}{result}{space 1}        2{col 53}{text} {col 54}{c |}
{res}{col 1}{text}        year{col 14}{c |}{space 1}       16{col 27}{space 1}        1{col 39}{result}{space 1}       15{col 53}{text} {col 54}{c |}
{res}{col 1}{text}     sg_vote{col 14}{c |}{space 1}        3{col 27}{space 1}        1{col 39}{result}{space 1}        2{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}    papmajor{col 14}{c |}{space 1}       20{col 27}{space 1}        1{col 39}{result}{space 1}       19{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
? = number of redundant parameters may be higher
{res}{txt}({res}est1{txt} stored)

{com}. eststo: reghdfe party_diff lorgs*  $lpdd_controls_floor & state == "co" $lppd_absorb2
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 6 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}     5,920
{txt}Absorbing 4 HDFE groups{col 51}F({res}   5{txt},{res}   1962{txt}){col 67}= {res}     30.01
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0000
{txt}{col 51}R-squared{col 67}= {res}    0.1293
{txt}{col 51}Adj R-squared{col 67}= {res}    0.1247
{txt}{col 51}Within R-sq.{col 67}= {res}    0.0642
{txt}{col 1}Number of clusters ({res}bill_id{txt}) {col 30}= {res}     1,963{txt}{col 51}Root MSE{col 67}= {res}    0.3305

{txt}{ralign 79:(Std. Err. adjusted for {res:1,963} clusters in bill_id)}
{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}    Robust
{col 1}   party_diff{col 15}{c |}      Coef.{col 27}   Std. Err.{col 39}      t{col 47}   P>|t|{col 55}     [95% Con{col 68}f. Interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 6}lorgs_G {c |}{col 15}{res}{space 2}-.0006338{col 27}{space 2}  .011858{col 38}{space 1}   -0.05{col 47}{space 3}0.957{col 55}{space 4}-.0238893{col 68}{space 3} .0226217
{txt}{space 6}lorgs_B {c |}{col 15}{res}{space 2} .0079518{col 27}{space 2} .0116164{col 38}{space 1}    0.68{col 47}{space 3}0.494{col 55}{space 4}-.0148301{col 68}{space 3} .0307337
{txt}{space 6}lorgs_N {c |}{col 15}{res}{space 2} .0535418{col 27}{space 2} .0118992{col 38}{space 1}    4.50{col 47}{space 3}0.000{col 55}{space 4} .0302054{col 68}{space 3} .0768782
{txt}{space 6}salient {c |}{col 15}{res}{space 2} .0966567{col 27}{space 2} .0187212{col 38}{space 1}    5.16{col 47}{space 3}0.000{col 55}{space 4} .0599411{col 68}{space 3} .1333723
{txt}spon_mean_ext {c |}{col 15}{res}{space 2} .0448589{col 27}{space 2} .0089863{col 38}{space 1}    4.99{col 47}{space 3}0.000{col 55}{space 4} .0272351{col 68}{space 3} .0624826
{txt}{space 8}_cons {c |}{col 15}{res}{space 2} .0807051{col 27}{space 2} .0200321{col 38}{space 1}    4.03{col 47}{space 3}0.000{col 55}{space 4} .0414187{col 68}{space 3} .1199915
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}      senate{col 14}{c |}{space 1}        2{col 27}{space 1}        0{col 39}{result}{space 1}        2{col 53}{text} {col 54}{c |}
{res}{col 1}{text}        year{col 14}{c |}{space 1}        4{col 27}{space 1}        1{col 39}{result}{space 1}        3{col 53}{text} {col 54}{c |}
{res}{col 1}{text}     sg_vote{col 14}{c |}{space 1}        3{col 27}{space 1}        1{col 39}{result}{space 1}        2{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}    papmajor{col 14}{c |}{space 1}       21{col 27}{space 1}        1{col 39}{result}{space 1}       20{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
? = number of redundant parameters may be higher
{res}{txt}({res}est2{txt} stored)

{com}. eststo: reghdfe party_diff lorgs*  $lpdd_controls_floor & state == "oh" $lppd_absorb2
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 6 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}     2,177
{txt}Absorbing 4 HDFE groups{col 51}F({res}   5{txt},{res}    717{txt}){col 67}= {res}     24.67
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0000
{txt}{col 51}R-squared{col 67}= {res}    0.5813
{txt}{col 51}Adj R-squared{col 67}= {res}    0.5761
{txt}{col 51}Within R-sq.{col 67}= {res}    0.1331
{txt}{col 1}Number of clusters ({res}bill_id{txt}) {col 30}= {res}       718{txt}{col 51}Root MSE{col 67}= {res}    0.2648

{txt}{ralign 79:(Std. Err. adjusted for {res:718} clusters in bill_id)}
{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}    Robust
{col 1}   party_diff{col 15}{c |}      Coef.{col 27}   Std. Err.{col 39}      t{col 47}   P>|t|{col 55}     [95% Con{col 68}f. Interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 6}lorgs_G {c |}{col 15}{res}{space 2}-.0347698{col 27}{space 2} .0192732{col 38}{space 1}   -1.80{col 47}{space 3}0.072{col 55}{space 4}-.0726084{col 68}{space 3} .0030688
{txt}{space 6}lorgs_B {c |}{col 15}{res}{space 2} .0479821{col 27}{space 2} .0151348{col 38}{space 1}    3.17{col 47}{space 3}0.002{col 55}{space 4} .0182683{col 68}{space 3}  .077696
{txt}{space 6}lorgs_N {c |}{col 15}{res}{space 2} .0462652{col 27}{space 2} .0180138{col 38}{space 1}    2.57{col 47}{space 3}0.010{col 55}{space 4} .0108992{col 68}{space 3} .0816313
{txt}{space 6}salient {c |}{col 15}{res}{space 2} .1160487{col 27}{space 2} .0219438{col 38}{space 1}    5.29{col 47}{space 3}0.000{col 55}{space 4}  .072967{col 68}{space 3} .1591305
{txt}spon_mean_ext {c |}{col 15}{res}{space 2} .0619497{col 27}{space 2} .0265818{col 38}{space 1}    2.33{col 47}{space 3}0.020{col 55}{space 4} .0097622{col 68}{space 3} .1141372
{txt}{space 8}_cons {c |}{col 15}{res}{space 2} .0656312{col 27}{space 2} .0329696{col 38}{space 1}    1.99{col 47}{space 3}0.047{col 55}{space 4} .0009027{col 68}{space 3} .1303596
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}      senate{col 14}{c |}{space 1}        2{col 27}{space 1}        0{col 39}{result}{space 1}        2{col 53}{text} {col 54}{c |}
{res}{col 1}{text}        year{col 14}{c |}{space 1}        2{col 27}{space 1}        1{col 39}{result}{space 1}        1{col 53}{text} {col 54}{c |}
{res}{col 1}{text}     sg_vote{col 14}{c |}{space 1}        3{col 27}{space 1}        1{col 39}{result}{space 1}        2{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}    papmajor{col 14}{c |}{space 1}       19{col 27}{space 1}        1{col 39}{result}{space 1}       18{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
? = number of redundant parameters may be higher
{res}{txt}({res}est3{txt} stored)

{com}. eststo: reghdfe party_diff lorgs*  $lpdd_controls_floor & state == "wi" $lppd_absorb2
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 7 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}     1,466
{txt}Absorbing 4 HDFE groups{col 51}F({res}   5{txt},{res}    614{txt}){col 67}= {res}      5.83
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0000
{txt}{col 51}R-squared{col 67}= {res}    0.4442
{txt}{col 51}Adj R-squared{col 67}= {res}    0.4334
{txt}{col 51}Within R-sq.{col 67}= {res}    0.0610
{txt}{col 1}Number of clusters ({res}bill_id{txt}) {col 30}= {res}       615{txt}{col 51}Root MSE{col 67}= {res}    0.3006

{txt}{ralign 79:(Std. Err. adjusted for {res:615} clusters in bill_id)}
{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}    Robust
{col 1}   party_diff{col 15}{c |}      Coef.{col 27}   Std. Err.{col 39}      t{col 47}   P>|t|{col 55}     [95% Con{col 68}f. Interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 6}lorgs_G {c |}{col 15}{res}{space 2}-.0181286{col 27}{space 2} .0208911{col 38}{space 1}   -0.87{col 47}{space 3}0.386{col 55}{space 4}-.0591552{col 68}{space 3} .0228981
{txt}{space 6}lorgs_B {c |}{col 15}{res}{space 2}-.0166571{col 27}{space 2} .0221656{col 38}{space 1}   -0.75{col 47}{space 3}0.453{col 55}{space 4}-.0601866{col 68}{space 3} .0268724
{txt}{space 6}lorgs_N {c |}{col 15}{res}{space 2} .0489028{col 27}{space 2} .0205729{col 38}{space 1}    2.38{col 47}{space 3}0.018{col 55}{space 4}  .008501{col 68}{space 3} .0893045
{txt}{space 6}salient {c |}{col 15}{res}{space 2}-.0276105{col 27}{space 2} .0256755{col 38}{space 1}   -1.08{col 47}{space 3}0.283{col 55}{space 4}-.0780329{col 68}{space 3}  .022812
{txt}spon_mean_ext {c |}{col 15}{res}{space 2} .1953754{col 27}{space 2} .0410811{col 38}{space 1}    4.76{col 47}{space 3}0.000{col 55}{space 4} .1146989{col 68}{space 3}  .276052
{txt}{space 8}_cons {c |}{col 15}{res}{space 2} .4115481{col 27}{space 2} .0482139{col 38}{space 1}    8.54{col 47}{space 3}0.000{col 55}{space 4} .3168639{col 68}{space 3} .5062323
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}      senate{col 14}{c |}{space 1}        2{col 27}{space 1}        0{col 39}{result}{space 1}        2{col 53}{text} {col 54}{c |}
{res}{col 1}{text}        year{col 14}{c |}{space 1}        3{col 27}{space 1}        1{col 39}{result}{space 1}        2{col 53}{text} {col 54}{c |}
{res}{col 1}{text}     sg_vote{col 14}{c |}{space 1}        3{col 27}{space 1}        1{col 39}{result}{space 1}        2{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}    papmajor{col 14}{c |}{space 1}       19{col 27}{space 1}        1{col 39}{result}{space 1}       18{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
? = number of redundant parameters may be higher
{res}{txt}({res}est4{txt} stored)

{com}. esttab  , se label replace star(* 0.05 ** 0.01) ///
> order(lorgs_N lorgs_B lorgs_G salient) b(2) se(2) ///
> title("All: Fixed effects for session, chamber, vote type excluded).") ///
> mtitles("us" "co" "oh" "wi") 
{res}
{txt}All: Fixed effects for session, chamber, vote type excluded).
{txt}{hline 80}
{txt}                              (1)            (2)            (3)            (4)  
{txt}                               us             co             oh             wi  
{txt}{hline 80}
{txt}lorgs_N             {res}         0.10**         0.05**         0.05*          0.05* {txt}
                    {res} {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}  {txt}

{txt}lorgs_B             {res}         0.00           0.01           0.05**        -0.02  {txt}
                    {res} {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}  {txt}

{txt}lorgs_G             {res}        -0.05**        -0.00          -0.03          -0.02  {txt}
                    {res} {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}  {txt}

{txt}salient             {res}         0.02           0.10**         0.12**        -0.03  {txt}
                    {res} {ralign 12:{txt:(}0.02{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}   {ralign 12:{txt:(}0.03{txt:)}}  {txt}

{txt}spon_mean_ext       {res}         0.15**         0.04**         0.06*          0.20**{txt}
                    {res} {ralign 12:{txt:(}0.04{txt:)}}   {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.03{txt:)}}   {ralign 12:{txt:(}0.04{txt:)}}  {txt}

{txt}Constant            {res}         0.24**         0.08**         0.07*          0.41**{txt}
                    {res} {ralign 12:{txt:(}0.03{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}   {ralign 12:{txt:(}0.03{txt:)}}   {ralign 12:{txt:(}0.05{txt:)}}  {txt}
{txt}{hline 80}
{txt}Observations        {res}         7411           5920           2177           1466  {txt}
{txt}{hline 80}
{txt}Standard errors in parentheses
{txt}* p<0.05, ** p<0.01

{com}. 
. 
. //Table 3:
. eststo clear
{txt}
{com}. eststo: reghdfe party_diff *_opp *_supp $lpdd_controls_comm & state == "co" $lppd_absorb2
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 5 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}    18,216
{txt}Absorbing 4 HDFE groups{col 51}F({res}   8{txt},{res}   3379{txt}){col 67}= {res}    106.26
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0000
{txt}{col 51}R-squared{col 67}= {res}    0.2641
{txt}{col 51}Adj R-squared{col 67}= {res}    0.2626
{txt}{col 51}Within R-sq.{col 67}= {res}    0.1724
{txt}{col 1}Number of clusters ({res}bill_id{txt}) {col 30}= {res}     3,380{txt}{col 51}Root MSE{col 67}= {res}    0.3557

{txt}{ralign 79:(Std. Err. adjusted for {res:3,380} clusters in bill_id)}
{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}    Robust
{col 1}   party_diff{col 15}{c |}      Coef.{col 27}   Std. Err.{col 39}      t{col 47}   P>|t|{col 55}     [95% Con{col 68}f. Interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 1}lporgs_G_opp {c |}{col 15}{res}{space 2} .0064882{col 27}{space 2} .0228831{col 38}{space 1}    0.28{col 47}{space 3}0.777{col 55}{space 4} -.038378{col 68}{space 3} .0513544
{txt}{space 1}lporgs_B_opp {c |}{col 15}{res}{space 2} .0005067{col 27}{space 2} .0170671{col 38}{space 1}    0.03{col 47}{space 3}0.976{col 55}{space 4}-.0329562{col 68}{space 3} .0339696
{txt}{space 1}lporgs_N_opp {c |}{col 15}{res}{space 2} .1628288{col 27}{space 2}  .011198{col 38}{space 1}   14.54{col 47}{space 3}0.000{col 55}{space 4} .1408731{col 68}{space 3} .1847844
{txt}lporgs_G_supp {c |}{col 15}{res}{space 2}-.0151096{col 27}{space 2} .0118621{col 38}{space 1}   -1.27{col 47}{space 3}0.203{col 55}{space 4}-.0383672{col 68}{space 3}  .008148
{txt}lporgs_B_supp {c |}{col 15}{res}{space 2}-.0064972{col 27}{space 2} .0120671{col 38}{space 1}   -0.54{col 47}{space 3}0.590{col 55}{space 4}-.0301567{col 68}{space 3} .0171623
{txt}lporgs_N_supp {c |}{col 15}{res}{space 2}  .028692{col 27}{space 2} .0082906{col 38}{space 1}    3.46{col 47}{space 3}0.001{col 55}{space 4} .0124368{col 68}{space 3} .0449471
{txt}{space 6}salient {c |}{col 15}{res}{space 2} .0892744{col 27}{space 2} .0157175{col 38}{space 1}    5.68{col 47}{space 3}0.000{col 55}{space 4} .0584577{col 68}{space 3} .1200911
{txt}spon_mean_ext {c |}{col 15}{res}{space 2} .0531648{col 27}{space 2}  .007094{col 38}{space 1}    7.49{col 47}{space 3}0.000{col 55}{space 4} .0392559{col 68}{space 3} .0670738
{txt}{space 8}_cons {c |}{col 15}{res}{space 2} .1756103{col 27}{space 2} .0113611{col 38}{space 1}   15.46{col 47}{space 3}0.000{col 55}{space 4}  .153335{col 68}{space 3} .1978857
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}      senate{col 14}{c |}{space 1}        2{col 27}{space 1}        0{col 39}{result}{space 1}        2{col 53}{text} {col 54}{c |}
{res}{col 1}{text}        year{col 14}{c |}{space 1}        6{col 27}{space 1}        1{col 39}{result}{space 1}        5{col 53}{text} {col 54}{c |}
{res}{col 1}{text}     sg_vote{col 14}{c |}{space 1}        2{col 27}{space 1}        1{col 39}{result}{space 1}        1{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}    papmajor{col 14}{c |}{space 1}       21{col 27}{space 1}        1{col 39}{result}{space 1}       20{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
? = number of redundant parameters may be higher
{res}{txt}({res}est1{txt} stored)

{com}. eststo: reghdfe party_diff *_opp *_supp $lpdd_controls_floor & state == "co" $lppd_absorb2
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 6 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}     5,920
{txt}Absorbing 4 HDFE groups{col 51}F({res}   8{txt},{res}   1962{txt}){col 67}= {res}     24.75
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0000
{txt}{col 51}R-squared{col 67}= {res}    0.1427
{txt}{col 51}Adj R-squared{col 67}= {res}    0.1378
{txt}{col 51}Within R-sq.{col 67}= {res}    0.0787
{txt}{col 1}Number of clusters ({res}bill_id{txt}) {col 30}= {res}     1,963{txt}{col 51}Root MSE{col 67}= {res}    0.3280

{txt}{ralign 79:(Std. Err. adjusted for {res:1,963} clusters in bill_id)}
{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}    Robust
{col 1}   party_diff{col 15}{c |}      Coef.{col 27}   Std. Err.{col 39}      t{col 47}   P>|t|{col 55}     [95% Con{col 68}f. Interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 1}lporgs_G_opp {c |}{col 15}{res}{space 2} -.022773{col 27}{space 2} .0249165{col 38}{space 1}   -0.91{col 47}{space 3}0.361{col 55}{space 4}-.0716386{col 68}{space 3} .0260925
{txt}{space 1}lporgs_B_opp {c |}{col 15}{res}{space 2} .0121773{col 27}{space 2} .0197425{col 38}{space 1}    0.62{col 47}{space 3}0.537{col 55}{space 4}-.0265411{col 68}{space 3} .0508956
{txt}{space 1}lporgs_N_opp {c |}{col 15}{res}{space 2} .0664682{col 27}{space 2} .0135703{col 38}{space 1}    4.90{col 47}{space 3}0.000{col 55}{space 4} .0398544{col 68}{space 3} .0930819
{txt}lporgs_G_supp {c |}{col 15}{res}{space 2} .0114038{col 27}{space 2} .0141425{col 38}{space 1}    0.81{col 47}{space 3}0.420{col 55}{space 4}-.0163321{col 68}{space 3} .0391397
{txt}lporgs_B_supp {c |}{col 15}{res}{space 2}  .011391{col 27}{space 2} .0128911{col 38}{space 1}    0.88{col 47}{space 3}0.377{col 55}{space 4}-.0138907{col 68}{space 3} .0366727
{txt}lporgs_N_supp {c |}{col 15}{res}{space 2} .0391525{col 27}{space 2}  .009847{col 38}{space 1}    3.98{col 47}{space 3}0.000{col 55}{space 4} .0198409{col 68}{space 3} .0584641
{txt}{space 6}salient {c |}{col 15}{res}{space 2} .0739317{col 27}{space 2} .0194301{col 38}{space 1}    3.81{col 47}{space 3}0.000{col 55}{space 4} .0358258{col 68}{space 3} .1120376
{txt}spon_mean_ext {c |}{col 15}{res}{space 2} .0424769{col 27}{space 2} .0089895{col 38}{space 1}    4.73{col 47}{space 3}0.000{col 55}{space 4}  .024847{col 68}{space 3} .0601068
{txt}{space 8}_cons {c |}{col 15}{res}{space 2} .1333793{col 27}{space 2} .0140103{col 38}{space 1}    9.52{col 47}{space 3}0.000{col 55}{space 4} .1059027{col 68}{space 3} .1608558
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}      senate{col 14}{c |}{space 1}        2{col 27}{space 1}        0{col 39}{result}{space 1}        2{col 53}{text} {col 54}{c |}
{res}{col 1}{text}        year{col 14}{c |}{space 1}        4{col 27}{space 1}        1{col 39}{result}{space 1}        3{col 53}{text} {col 54}{c |}
{res}{col 1}{text}     sg_vote{col 14}{c |}{space 1}        3{col 27}{space 1}        1{col 39}{result}{space 1}        2{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}    papmajor{col 14}{c |}{space 1}       21{col 27}{space 1}        1{col 39}{result}{space 1}       20{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
? = number of redundant parameters may be higher
{res}{txt}({res}est2{txt} stored)

{com}. eststo: reghdfe party_diff *_opp *_supp $lpdd_controls_floor & state == "wi" $lppd_absorb2
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 7 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}     1,466
{txt}Absorbing 4 HDFE groups{col 51}F({res}   8{txt},{res}    614{txt}){col 67}= {res}      8.99
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0000
{txt}{col 51}R-squared{col 67}= {res}    0.4748
{txt}{col 51}Adj R-squared{col 67}= {res}    0.4634
{txt}{col 51}Within R-sq.{col 67}= {res}    0.1126
{txt}{col 1}Number of clusters ({res}bill_id{txt}) {col 30}= {res}       615{txt}{col 51}Root MSE{col 67}= {res}    0.2925

{txt}{ralign 79:(Std. Err. adjusted for {res:615} clusters in bill_id)}
{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}    Robust
{col 1}   party_diff{col 15}{c |}      Coef.{col 27}   Std. Err.{col 39}      t{col 47}   P>|t|{col 55}     [95% Con{col 68}f. Interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 1}lporgs_G_opp {c |}{col 15}{res}{space 2}-.0615912{col 27}{space 2} .0394937{col 38}{space 1}   -1.56{col 47}{space 3}0.119{col 55}{space 4}-.1391504{col 68}{space 3}  .015968
{txt}{space 1}lporgs_B_opp {c |}{col 15}{res}{space 2}-.0093982{col 27}{space 2} .0404197{col 38}{space 1}   -0.23{col 47}{space 3}0.816{col 55}{space 4}-.0887758{col 68}{space 3} .0699794
{txt}{space 1}lporgs_N_opp {c |}{col 15}{res}{space 2} .1105914{col 27}{space 2} .0190112{col 38}{space 1}    5.82{col 47}{space 3}0.000{col 55}{space 4} .0732566{col 68}{space 3} .1479263
{txt}lporgs_G_supp {c |}{col 15}{res}{space 2}-.0135819{col 27}{space 2}   .02373{col 38}{space 1}   -0.57{col 47}{space 3}0.567{col 55}{space 4}-.0601836{col 68}{space 3} .0330199
{txt}lporgs_B_supp {c |}{col 15}{res}{space 2}-.0312737{col 27}{space 2} .0244642{col 38}{space 1}   -1.28{col 47}{space 3}0.202{col 55}{space 4}-.0793174{col 68}{space 3}   .01677
{txt}lporgs_N_supp {c |}{col 15}{res}{space 2}-.0038791{col 27}{space 2}  .019004{col 38}{space 1}   -0.20{col 47}{space 3}0.838{col 55}{space 4}-.0411997{col 68}{space 3} .0334416
{txt}{space 6}salient {c |}{col 15}{res}{space 2}-.0317827{col 27}{space 2} .0270846{col 38}{space 1}   -1.17{col 47}{space 3}0.241{col 55}{space 4}-.0849723{col 68}{space 3} .0214069
{txt}spon_mean_ext {c |}{col 15}{res}{space 2} .1787777{col 27}{space 2} .0419392{col 38}{space 1}    4.26{col 47}{space 3}0.000{col 55}{space 4}  .096416{col 68}{space 3} .2611395
{txt}{space 8}_cons {c |}{col 15}{res}{space 2} .4408243{col 27}{space 2} .0439988{col 38}{space 1}   10.02{col 47}{space 3}0.000{col 55}{space 4} .3544179{col 68}{space 3} .5272306
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}      senate{col 14}{c |}{space 1}        2{col 27}{space 1}        0{col 39}{result}{space 1}        2{col 53}{text} {col 54}{c |}
{res}{col 1}{text}        year{col 14}{c |}{space 1}        3{col 27}{space 1}        1{col 39}{result}{space 1}        2{col 53}{text} {col 54}{c |}
{res}{col 1}{text}     sg_vote{col 14}{c |}{space 1}        3{col 27}{space 1}        1{col 39}{result}{space 1}        2{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}    papmajor{col 14}{c |}{space 1}       19{col 27}{space 1}        1{col 39}{result}{space 1}       18{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
? = number of redundant parameters may be higher
{res}{txt}({res}est3{txt} stored)

{com}. 
. esttab , se label replace star(* 0.05 ** 0.01) ///
> order(lporgs_N_opp lporgs_N_supp lporgs_B_opp lporgs_B_supp   lporgs_G_opp lporgs_G_supp salient) b(2) se(2) ///
> title("COWI: Fixed effects for session, chamber, vote type excluded).") ///
> mtitles("comm" "floor" "floor-WI") 
{res}
{txt}COWI: Fixed effects for session, chamber, vote type excluded).
{txt}{hline 65}
{txt}                              (1)            (2)            (3)  
{txt}                             comm          floor       floor-WI  
{txt}{hline 65}
{txt}lporgs_N_opp        {res}         0.16**         0.07**         0.11**{txt}
                    {res} {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}  {txt}

{txt}lporgs_N_supp       {res}         0.03**         0.04**        -0.00  {txt}
                    {res} {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}  {txt}

{txt}lporgs_B_opp        {res}         0.00           0.01          -0.01  {txt}
                    {res} {ralign 12:{txt:(}0.02{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}   {ralign 12:{txt:(}0.04{txt:)}}  {txt}

{txt}lporgs_B_supp       {res}        -0.01           0.01          -0.03  {txt}
                    {res} {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}  {txt}

{txt}lporgs_G_opp        {res}         0.01          -0.02          -0.06  {txt}
                    {res} {ralign 12:{txt:(}0.02{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}   {ralign 12:{txt:(}0.04{txt:)}}  {txt}

{txt}lporgs_G_supp       {res}        -0.02           0.01          -0.01  {txt}
                    {res} {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}  {txt}

{txt}salient             {res}         0.09**         0.07**        -0.03  {txt}
                    {res} {ralign 12:{txt:(}0.02{txt:)}}   {ralign 12:{txt:(}0.02{txt:)}}   {ralign 12:{txt:(}0.03{txt:)}}  {txt}

{txt}spon_mean_ext       {res}         0.05**         0.04**         0.18**{txt}
                    {res} {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.04{txt:)}}  {txt}

{txt}Constant            {res}         0.18**         0.13**         0.44**{txt}
                    {res} {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.01{txt:)}}   {ralign 12:{txt:(}0.04{txt:)}}  {txt}
{txt}{hline 65}
{txt}Observations        {res}        18216           5920           1466  {txt}
{txt}{hline 65}
{txt}Standard errors in parentheses
{txt}* p<0.05, ** p<0.01

{com}. 
. 
. 
{txt}end of do-file

{com}. 
{txt}end of do-file

{com}. do "/var/folders/48/w4xrc9rj3xn1jqm9rx8h3pjhj3hlq1/T//SD02973.000000"
{txt}
{com}. do "LAP_Replication_3_Figure_1.do"
{txt}
{com}. //1. set this to the desired path
. cd "~/Desktop/LAP_PSRM_Replication/"
{res}/Users/garlicka/Desktop/LAP_PSRM_Replication
{txt}
{com}. 
. //2. Import the Garlick (2017) replication data  with the additional roll call votes from main analysis
. use "LAP_Replication_COOHWIUS.dta", clear
{txt}
{com}. 
. //3. Find passage votes 
. gen voted = 0 
{txt}
{com}. replace voted = 1 if sg_v == 2 
{txt}(13,517 real changes made)

{com}. 
. //4. Make each bill into a line
. collapse (max) voted, by( bill_id session state)
{txt}
{com}. 
. 
. //5. Find the numerator (voted bills) and denominator (total bills) per session.
. gen total = 1
{txt}
{com}. collapse (sum) voted total, by(session state)
{txt}
{com}. 
. //6. Choose which sessions to put in the graph
. gen graph = 1
{txt}
{com}. local bads "2012A 2011A 2017A 2018A"
{txt}
{com}. foreach b of local bads{c -(}
{txt}  2{com}. replace graph = 0 if  session == "`b'"
{txt}  3{com}. {c )-}
{txt}(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)

{com}. 
. forvalues c = 106/109{c -(}
{txt}  2{com}. replace graph = 0 if session == "`c'"
{txt}  3{com}. {c )-}
{txt}(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)

{com}. replace graph = 0 if session == "2015 Regular Session"
{txt}(1 real change made)

{com}. 
. 
. //7. Fix the graph labels
. replace session = session + "th" if state == "us" | state == "oh"
{txt}(10 real changes made)

{com}. replace session = subinstr(session,"Regular Session","Reg.",.)
{txt}(4 real changes made)

{com}. sort state sess
{txt}
{com}. 
. //8. Calculate the bills being voted on
. gen notvoted = total-voted
{txt}
{com}. 
. //9. Set the labels
. replace state = "Colorado" if state == "co"
{txt}variable {bf}state{sf} was {bf}{res}str2{sf}{txt} now {bf}{res}str8{sf}
{txt}(8 real changes made)

{com}. replace state = "Ohio" if state == "oh"
{txt}(2 real changes made)

{com}. replace state = "Wisconsin" if state == "wi"
{txt}variable {bf}state{sf} was {bf}{res}str8{sf}{txt} now {bf}{res}str9{sf}
{txt}(4 real changes made)

{com}. replace state = "U.S. Congress" if state == "us"
{txt}variable {bf}state{sf} was {bf}{res}str9{sf}{txt} now {bf}{res}str13{sf}
{txt}(8 real changes made)

{com}. 
. 
. //10. Figure 1
.         graph hbar (sum) voted notvoted if graph == 1, perc over(session) by(state, note("")) ///
>         stack nofill legend(order(1 "Had passage vote" 2 "No passage vote"))  ytitle(Share of regular bills receiving a passage vote) ///
>         blabel(bar, position(center) format(%9.0f))
{res}{txt}
{com}. 
{txt}end of do-file

{com}. 
{txt}end of do-file

{com}. do "/var/folders/48/w4xrc9rj3xn1jqm9rx8h3pjhj3hlq1/T//SD02973.000000"
{txt}
{com}. do "LAP_Replication_4_Table_5_Figure_2.do"
{txt}
{com}. //1. set this to the desired path
. cd "~/Desktop/LAP_PSRM_Replication/"
{res}/Users/garlicka/Desktop/LAP_PSRM_Replication
{txt}
{com}. 
. //2. Import the core replication file
. use "LAP_Replication_MatchedBills_COOHWI.dta", clear
{txt}
{com}. 
. //3. Extract the year so it can used as a fixed effect
. gen year = substr(bill_id,4,4)
{txt}
{com}. 
. //4. Transform the average sponsor ideal point to a measure of extremity.
. // Multiple liberal (negative) scores by negative one, so it resembles an absolute value, without assuming zero is the midpoint)
. gen spon_ext = spon_mean
{txt}(40 missing values generated)

{com}. replace spon_ext = spon_mean * -1 if spon_mean < 0 
{txt}(58 real changes made)

{com}. 
. //5. Create a unique identifer of the two-state dyad 
. gen state_combo = ustrleft(state,2) +"_"+ustrright(M_state,2)
{txt}
{com}. 
. //6. Run a regression to establish the sample
. global Minsamp "salient spon_ext, absorb(sg_v) cluster(bill_id)"
{txt}
{com}. 
. //7. standardize the sample
. eststo clear
{txt}
{com}. eststo: reghdfe party_diff M_lorgs* lorgs* $Minsamp
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 1 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}       213
{txt}Absorbing 1 HDFE group{col 51}F({res}   8{txt},{res}     45{txt}){col 67}= {res}      3.15
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0064
{txt}{col 51}R-squared{col 67}= {res}    0.4593
{txt}{col 51}Adj R-squared{col 67}= {res}    0.4325
{txt}{col 51}Within R-sq.{col 67}= {res}    0.2602
{txt}{col 1}Number of clusters ({res}bill_id{txt}) {col 30}= {res}        46{txt}{col 51}Root MSE{col 67}= {res}    0.3117

{txt}{ralign 78:(Std. Err. adjusted for {res:46} clusters in bill_id)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}  party_diff{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}M_lorgs_N {c |}{col 14}{res}{space 2}-.0526128{col 26}{space 2} .0598719{col 37}{space 1}   -0.88{col 46}{space 3}0.384{col 54}{space 4}-.1732009{col 67}{space 3} .0679754
{txt}{space 3}M_lorgs_B {c |}{col 14}{res}{space 2}-.0113714{col 26}{space 2} .0640827{col 37}{space 1}   -0.18{col 46}{space 3}0.860{col 54}{space 4}-.1404405{col 67}{space 3} .1176977
{txt}{space 3}M_lorgs_G {c |}{col 14}{res}{space 2} .0850467{col 26}{space 2}  .077286{col 37}{space 1}    1.10{col 46}{space 3}0.277{col 54}{space 4}-.0706153{col 67}{space 3} .2407088
{txt}{space 5}lorgs_N {c |}{col 14}{res}{space 2} .0462806{col 26}{space 2} .1002664{col 37}{space 1}    0.46{col 46}{space 3}0.647{col 54}{space 4}-.1556663{col 67}{space 3} .2482274
{txt}{space 5}lorgs_B {c |}{col 14}{res}{space 2}-.0233248{col 26}{space 2} .0635122{col 37}{space 1}   -0.37{col 46}{space 3}0.715{col 54}{space 4} -.151245{col 67}{space 3} .1045953
{txt}{space 5}lorgs_G {c |}{col 14}{res}{space 2}-.2452017{col 26}{space 2} .0858467{col 37}{space 1}   -2.86{col 46}{space 3}0.006{col 54}{space 4}-.4181058{col 67}{space 3}-.0722975
{txt}{space 5}salient {c |}{col 14}{res}{space 2} .2306225{col 26}{space 2} .0988711{col 37}{space 1}    2.33{col 46}{space 3}0.024{col 54}{space 4}  .031486{col 67}{space 3} .4297591
{txt}{space 4}spon_ext {c |}{col 14}{res}{space 2}-.0650676{col 26}{space 2} .1108304{col 37}{space 1}   -0.59{col 46}{space 3}0.560{col 54}{space 4}-.2882915{col 67}{space 3} .1581563
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .6296714{col 26}{space 2} .2387022{col 37}{space 1}    2.64{col 46}{space 3}0.011{col 54}{space 4} .1489005{col 67}{space 3} 1.110442
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}     sg_vote{col 14}{c |}{space 1}        3{col 27}{space 1}        0{col 39}{result}{space 1}        3{col 53}{text} {col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
{res}{txt}({res}est1{txt} stored)

{com}. rename _est_est1 insamp
{res}{txt}
{com}. 
. //8. Run the regressions
. global Mcontrols "salient spon_ext if insamp == 1, absorb(sg_v state_combo year) cluster(bill_id)"
{txt}
{com}. eststo clear
{txt}
{com}. eststo: reghdfe party_diff lorgs* $Mcontrols
{res}{txt}(dropped 1 {browse "http://scorreia.com/research/singletons.pdf":singleton observations})
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 6 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}       212
{txt}Absorbing 3 HDFE groups{col 51}F({res}   5{txt},{res}     44{txt}){col 67}= {res}      2.12
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0803
{txt}{col 51}R-squared{col 67}= {res}    0.6757
{txt}{col 51}Adj R-squared{col 67}= {res}    0.6544
{txt}{col 51}Within R-sq.{col 67}= {res}    0.0932
{txt}{col 1}Number of clusters ({res}bill_id{txt}) {col 30}= {res}        45{txt}{col 51}Root MSE{col 67}= {res}    0.2438

{txt}{ralign 78:(Std. Err. adjusted for {res:45} clusters in bill_id)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}  party_diff{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 5}lorgs_N {c |}{col 14}{res}{space 2} .1508733{col 26}{space 2} .0790806{col 37}{space 1}    1.91{col 46}{space 3}0.063{col 54}{space 4}-.0085032{col 67}{space 3} .3102498
{txt}{space 5}lorgs_B {c |}{col 14}{res}{space 2}-.0276058{col 26}{space 2} .0465723{col 37}{space 1}   -0.59{col 46}{space 3}0.556{col 54}{space 4}-.1214662{col 67}{space 3} .0662545
{txt}{space 5}lorgs_G {c |}{col 14}{res}{space 2}-.1204247{col 26}{space 2} .0803551{col 37}{space 1}   -1.50{col 46}{space 3}0.141{col 54}{space 4}-.2823698{col 67}{space 3} .0415204
{txt}{space 5}salient {c |}{col 14}{res}{space 2} .0669186{col 26}{space 2} .1030108{col 37}{space 1}    0.65{col 46}{space 3}0.519{col 54}{space 4}-.1406861{col 67}{space 3} .2745233
{txt}{space 4}spon_ext {c |}{col 14}{res}{space 2} .0143847{col 26}{space 2} .0477869{col 37}{space 1}    0.30{col 46}{space 3}0.765{col 54}{space 4}-.0819234{col 67}{space 3} .1106928
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .1762901{col 26}{space 2} .1768204{col 37}{space 1}    1.00{col 46}{space 3}0.324{col 54}{space 4}-.1800681{col 67}{space 3} .5326482
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}     sg_vote{col 14}{c |}{space 1}        3{col 27}{space 1}        0{col 39}{result}{space 1}        3{col 53}{text} {col 54}{c |}
{res}{col 1}{text} state_combo{col 14}{c |}{space 1}        5{col 27}{space 1}        1{col 39}{result}{space 1}        4{col 53}{text} {col 54}{c |}
{res}{col 1}{text}        year{col 14}{c |}{space 1}        4{col 27}{space 1}        2{col 39}{result}{space 1}        2{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
? = number of redundant parameters may be higher
{res}{txt}({res}est1{txt} stored)

{com}. eststo: reghdfe party_diff M_lorgs* $Mcontrols
{res}{txt}(dropped 1 {browse "http://scorreia.com/research/singletons.pdf":singleton observations})
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 6 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}       212
{txt}Absorbing 3 HDFE groups{col 51}F({res}   5{txt},{res}     44{txt}){col 67}= {res}      1.66
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.1648
{txt}{col 51}R-squared{col 67}= {res}    0.6719
{txt}{col 51}Adj R-squared{col 67}= {res}    0.6503
{txt}{col 51}Within R-sq.{col 67}= {res}    0.0826
{txt}{col 1}Number of clusters ({res}bill_id{txt}) {col 30}= {res}        45{txt}{col 51}Root MSE{col 67}= {res}    0.2452

{txt}{ralign 78:(Std. Err. adjusted for {res:45} clusters in bill_id)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}  party_diff{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}M_lorgs_N {c |}{col 14}{res}{space 2}-.0456744{col 26}{space 2} .0497596{col 37}{space 1}   -0.92{col 46}{space 3}0.364{col 54}{space 4}-.1459584{col 67}{space 3} .0546095
{txt}{space 3}M_lorgs_B {c |}{col 14}{res}{space 2}-.0351804{col 26}{space 2} .0450803{col 37}{space 1}   -0.78{col 46}{space 3}0.439{col 54}{space 4}-.1260338{col 67}{space 3}  .055673
{txt}{space 3}M_lorgs_G {c |}{col 14}{res}{space 2} .0449127{col 26}{space 2} .0558797{col 37}{space 1}    0.80{col 46}{space 3}0.426{col 54}{space 4}-.0677053{col 67}{space 3} .1575308
{txt}{space 5}salient {c |}{col 14}{res}{space 2}  .071291{col 26}{space 2} .0874802{col 37}{space 1}    0.81{col 46}{space 3}0.419{col 54}{space 4}-.1050138{col 67}{space 3} .2475959
{txt}{space 4}spon_ext {c |}{col 14}{res}{space 2} .0551514{col 26}{space 2} .0420584{col 37}{space 1}    1.31{col 46}{space 3}0.197{col 54}{space 4}-.0296117{col 67}{space 3} .1399144
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .3647871{col 26}{space 2} .0711445{col 37}{space 1}    5.13{col 46}{space 3}0.000{col 54}{space 4} .2214047{col 67}{space 3} .5081695
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}     sg_vote{col 14}{c |}{space 1}        3{col 27}{space 1}        0{col 39}{result}{space 1}        3{col 53}{text} {col 54}{c |}
{res}{col 1}{text} state_combo{col 14}{c |}{space 1}        5{col 27}{space 1}        1{col 39}{result}{space 1}        4{col 53}{text} {col 54}{c |}
{res}{col 1}{text}        year{col 14}{c |}{space 1}        4{col 27}{space 1}        2{col 39}{result}{space 1}        2{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
? = number of redundant parameters may be higher
{res}{txt}({res}est2{txt} stored)

{com}. eststo: reghdfe party_diff M_lorgs* lorgs* $Mcontrols
{res}{txt}(dropped 1 {browse "http://scorreia.com/research/singletons.pdf":singleton observations})
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 6 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}       212
{txt}Absorbing 3 HDFE groups{col 51}F({res}   8{txt},{res}     44{txt}){col 67}= {res}      3.07
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0078
{txt}{col 51}R-squared{col 67}= {res}    0.7009
{txt}{col 51}Adj R-squared{col 67}= {res}    0.6764
{txt}{col 51}Within R-sq.{col 67}= {res}    0.1638
{txt}{col 1}Number of clusters ({res}bill_id{txt}) {col 30}= {res}        45{txt}{col 51}Root MSE{col 67}= {res}    0.2359

{txt}{ralign 78:(Std. Err. adjusted for {res:45} clusters in bill_id)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}  party_diff{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}M_lorgs_N {c |}{col 14}{res}{space 2} -.079439{col 26}{space 2} .0401326{col 37}{space 1}   -1.98{col 46}{space 3}0.054{col 54}{space 4}-.1603209{col 67}{space 3} .0014428
{txt}{space 3}M_lorgs_B {c |}{col 14}{res}{space 2}-.0270803{col 26}{space 2} .0416018{col 37}{space 1}   -0.65{col 46}{space 3}0.518{col 54}{space 4}-.1109233{col 67}{space 3} .0567626
{txt}{space 3}M_lorgs_G {c |}{col 14}{res}{space 2} .0656527{col 26}{space 2} .0506041{col 37}{space 1}    1.30{col 46}{space 3}0.201{col 54}{space 4}-.0363331{col 67}{space 3} .1676386
{txt}{space 5}lorgs_N {c |}{col 14}{res}{space 2}  .178577{col 26}{space 2} .0712458{col 37}{space 1}    2.51{col 46}{space 3}0.016{col 54}{space 4} .0349906{col 67}{space 3} .3221633
{txt}{space 5}lorgs_B {c |}{col 14}{res}{space 2}-.0396983{col 26}{space 2}  .040977{col 37}{space 1}   -0.97{col 46}{space 3}0.338{col 54}{space 4} -.122282{col 67}{space 3} .0428854
{txt}{space 5}lorgs_G {c |}{col 14}{res}{space 2}-.1894536{col 26}{space 2} .0795165{col 37}{space 1}   -2.38{col 46}{space 3}0.022{col 54}{space 4}-.3497085{col 67}{space 3}-.0291986
{txt}{space 5}salient {c |}{col 14}{res}{space 2} .0048256{col 26}{space 2} .0836004{col 37}{space 1}    0.06{col 46}{space 3}0.954{col 54}{space 4}-.1636599{col 67}{space 3} .1733112
{txt}{space 4}spon_ext {c |}{col 14}{res}{space 2} .0193652{col 26}{space 2} .0501713{col 37}{space 1}    0.39{col 46}{space 3}0.701{col 54}{space 4}-.0817484{col 67}{space 3} .1204789
{txt}{space 7}_cons {c |}{col 14}{res}{space 2}  .334054{col 26}{space 2} .1753346{col 37}{space 1}    1.91{col 46}{space 3}0.063{col 54}{space 4}-.0193097{col 67}{space 3} .6874177
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}     sg_vote{col 14}{c |}{space 1}        3{col 27}{space 1}        0{col 39}{result}{space 1}        3{col 53}{text} {col 54}{c |}
{res}{col 1}{text} state_combo{col 14}{c |}{space 1}        5{col 27}{space 1}        1{col 39}{result}{space 1}        4{col 53}{text} {col 54}{c |}
{res}{col 1}{text}        year{col 14}{c |}{space 1}        4{col 27}{space 1}        2{col 39}{result}{space 1}        2{col 53}{text}?{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
? = number of redundant parameters may be higher
{res}{txt}({res}est3{txt} stored)

{com}. 
. //8. Table 4
. esttab , se replace label ///
> mtitles("actual" "placebo" "both") ///
> b(2) se(2) ///
> nodepv ///
> star(* 0.05 ** 0.01) ///
>  order( lorgs_N M_lorgs_N lorgs_B M_lorgs_B lorgs_G M_lorgs_G salient spon_ext)
{res}
{txt}{hline 65}
{txt}                              (1)            (2)            (3)  
{txt}                           actual        placebo           both  
{txt}{hline 65}
{txt}lorgs_N             {res}         0.15                          0.18* {txt}
                    {res} {ralign 12:{txt:(}0.08{txt:)}}                  {ralign 12:{txt:(}0.07{txt:)}}  {txt}

{txt}M_lorgs_N           {res}                       -0.05          -0.08  {txt}
                    {res}                {ralign 12:{txt:(}0.05{txt:)}}   {ralign 12:{txt:(}0.04{txt:)}}  {txt}

{txt}lorgs_B             {res}        -0.03                         -0.04  {txt}
                    {res} {ralign 12:{txt:(}0.05{txt:)}}                  {ralign 12:{txt:(}0.04{txt:)}}  {txt}

{txt}M_lorgs_B           {res}                       -0.04          -0.03  {txt}
                    {res}                {ralign 12:{txt:(}0.05{txt:)}}   {ralign 12:{txt:(}0.04{txt:)}}  {txt}

{txt}lorgs_G             {res}        -0.12                         -0.19* {txt}
                    {res} {ralign 12:{txt:(}0.08{txt:)}}                  {ralign 12:{txt:(}0.08{txt:)}}  {txt}

{txt}M_lorgs_G           {res}                        0.04           0.07  {txt}
                    {res}                {ralign 12:{txt:(}0.06{txt:)}}   {ralign 12:{txt:(}0.05{txt:)}}  {txt}

{txt}salient             {res}         0.07           0.07           0.00  {txt}
                    {res} {ralign 12:{txt:(}0.10{txt:)}}   {ralign 12:{txt:(}0.09{txt:)}}   {ralign 12:{txt:(}0.08{txt:)}}  {txt}

{txt}spon_ext            {res}         0.01           0.06           0.02  {txt}
                    {res} {ralign 12:{txt:(}0.05{txt:)}}   {ralign 12:{txt:(}0.04{txt:)}}   {ralign 12:{txt:(}0.05{txt:)}}  {txt}

{txt}Constant            {res}         0.18           0.36**         0.33  {txt}
                    {res} {ralign 12:{txt:(}0.18{txt:)}}   {ralign 12:{txt:(}0.07{txt:)}}   {ralign 12:{txt:(}0.18{txt:)}}  {txt}
{txt}{hline 65}
{txt}Observations        {res}          212            212            212  {txt}
{txt}{hline 65}
{txt}Standard errors in parentheses
{txt}* p<0.05, ** p<0.01

{com}. 
.  //9. Limit the sample to passage votes for Figure 2
.  gen insamp2 = insamp
{txt}
{com}.  replace insamp2 = 0 if sg_vote != 2
{txt}(113 real changes made)

{com}.  
.  //10. Create Figure 2
.  twoway ///
>         (scatter party_diff lorgs_N if insamp2, mcolor(black%40) msymbol(D) jitter(2)) (lfit party_diff lorgs_N if insamp2, lcolor(black) lpattern(solid)) ///
>         (scatter party_diff M_lorgs_N if insamp2, mcolor(blue%30) msymbol(Oh) jitter(2)) (lfit party_diff M_lorgs_N if insamp2, lcolor(blue) lpattern(dash)), ///
>         legend(order(1 "Actual groups" 2 "Actual fit" 3 "Placebo groups" 4 "Placebo fit")) ///
>         ytitle("Party Difference on passage votes") xtitle("No. of non-profit groups lobbying (log)") 
{res}{txt}
{com}.         
. 
{txt}end of do-file

{com}. do "LAP_Replication_5_Tables_4+8+9_Figure_3.do"
{txt}
{com}. //1. set this to the desired path
. cd "~/Desktop/LAP_PSRM_Replication/"
{res}/Users/garlicka/Desktop/LAP_PSRM_Replication
{txt}
{com}. 
. //2. Import the Garlick (2017) replication data  with the additional roll call votes from main analysis
. use "LAP_Replication_GarlickPlus_30states.dta", clear
{txt}
{com}. 
. //3. Find and keep the passage votes
. gen votes = 1
{txt}
{com}. keep if sg_v == 2
{txt}(130,301 observations deleted)

{com}. 
. //4. Find the average party difference on the state legislative years 
. collapse (mean) party_diff (sum) votes, by(state chamber year1)
{txt}
{com}. 
. //5. Limit the sample and prepare data to match Shor and Holyoke data
. drop if year1 < 2006 
{txt}(2 observations deleted)

{com}. replace state = upper(state)
{txt}(292 real changes made)

{com}. 
. //6. Merge in Shor McCarty 2015 data
. merge m:1 state year1 using "LAP_Replication_ShorMcCarty_50states.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}             371
{txt}{col 9}from master{col 30}{res}              45{txt}  (_merge==1)
{col 9}from using{col 30}{res}             326{txt}  (_merge==2)

{col 5}matched{col 30}{res}             247{txt}  (_merge==3)
{col 5}{hline 41}

{com}. 
. //7. Averager the distance between party medians across the two chambers
. egen avgdiff = rowmean(h_diffs s_diffs)
{txt}(84 missing values generated)

{com}. 
. //8. Create the upper chamber if there is only a lower chamber score
. expand 2 if _m == 2, gen(dupes)
{txt}(326 observations created)

{com}. replace chamber = "lower" if _m == 2 & dupes == 0
{txt}(326 real changes made)

{com}. replace chamber = "upper" if _m == 2 & dupes == 1
{txt}(326 real changes made)

{com}. drop _m dupes
{txt}
{com}. 
. //9. Bring in the Holyoke data on interest groups
. merge m:1 year1 state using "LAP_Replication_Holyoke_50states.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}              38
{txt}{col 9}from master{col 30}{res}               8{txt}  (_merge==1)
{col 9}from using{col 30}{res}              30{txt}  (_merge==2)

{col 5}matched{col 30}{res}             936{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _m
{txt}
{com}. 
. //10. Make the shor data fit the two line structure.
. gen diffs = .
{txt}(974 missing values generated)

{com}. replace diffs = h_diffs if chamber == "lower"
{txt}(392 real changes made)

{com}. replace diffs = s_diffs if chamber == "upper"
{txt}(395 real changes made)

{com}. label var diffs "Distance between party medians (Shor McCarty 2015)"
{txt}
{com}. drop h_diffs s_diffs
{txt}
{com}. 
. //11. Transform the holyoke data into its natural log and using the Laplace smoothing procedure
. foreach v of varlist holy* {c -(}
{txt}  2{com}. gen l`v' = log(`v' + 1)
{txt}  3{com}. {c )-}
{txt}(8 missing values generated)
(8 missing values generated)
(8 missing values generated)

{com}. 
. //12. Variable labels
. label var lholy_B "Businesses (log)"
{txt}
{com}. label var lholy_NP "Non-profits (log)"
{txt}
{com}. label var lholy_G "Governments (log)"
{txt}
{com}. 
. 
. //13. Highlight the states from the main analysis
. gen stlocal = .
{txt}(974 missing values generated)

{com}. replace stlocal = 1 if state == "CO" | state == "WI" | state == "OH"
{txt}(67 real changes made)

{com}. 
. 
. //14. Create Figure 3
. twoway ///
> (scatter party_diff lholy_B if stlocal == . , mcolor(red%80)) ///
> (scatter party_diff lholy_B if stlocal == 1 , msymbol(O) mcolor(red%80)) ///
> (scatter party_diff lholy_NP if stlocal == ., mcolor(blue%80)) ///
> (scatter party_diff lholy_NP if stlocal == 1 , msymbol(D) mcolor(blue%80)) ///
> (lfit party_diff lholy_B, lcolor(red%80)) ///
> (lfit party_diff lholy_NP, lpattern(solid) lcolor(blue%80)), ///
> legend( order (1 "Businesses" 5 "Fit" 3 "Non-profits" 6 "Fit")) ///
> xtitle("Number of Groups (log)") ytitle("Session Average Party Difference")
{res}{txt}
{com}. 
. 
. 
. //15. Run the regressions for Table 8 (first transform year)
. egen yrno = group(year1)
{txt}
{com}. 
. eststo clear
{txt}
{com}. eststo: reghdfe party_diff lholy_* if chamber == "lower" & year >= 2009 & year <= 2014 & votes >= 10, absorb(yrno ) cluster(state)
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 1 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}       114
{txt}Absorbing 1 HDFE group{col 51}F({res}   3{txt},{res}     29{txt}){col 67}= {res}      6.67
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0015
{txt}{col 51}R-squared{col 67}= {res}    0.3070
{txt}{col 51}Adj R-squared{col 67}= {res}    0.2542
{txt}{col 51}Within R-sq.{col 67}= {res}    0.2883
{txt}{col 1}Number of clusters ({res}state{txt}) {col 30}= {res}        30{txt}{col 51}Root MSE{col 67}= {res}    0.1136

{txt}{ralign 78:(Std. Err. adjusted for {res:30} clusters in state)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}  party_diff{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 5}lholy_B {c |}{col 14}{res}{space 2} -.200134{col 26}{space 2} .0529121{col 37}{space 1}   -3.78{col 46}{space 3}0.001{col 54}{space 4}-.3083513{col 67}{space 3}-.0919167
{txt}{space 5}lholy_G {c |}{col 14}{res}{space 2}-.0176861{col 26}{space 2} .0329224{col 37}{space 1}   -0.54{col 46}{space 3}0.595{col 54}{space 4}  -.08502{col 67}{space 3} .0496479
{txt}{space 4}lholy_NP {c |}{col 14}{res}{space 2} .2401383{col 26}{space 2} .0552011{col 37}{space 1}    4.35{col 46}{space 3}0.000{col 54}{space 4} .1272393{col 67}{space 3} .3530373
{txt}{space 7}_cons {c |}{col 14}{res}{space 2}-.0178062{col 26}{space 2}  .192722{col 37}{space 1}   -0.09{col 46}{space 3}0.927{col 54}{space 4}-.4119671{col 67}{space 3} .3763546
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}        yrno{col 14}{c |}{space 1}        6{col 27}{space 1}        0{col 39}{result}{space 1}        6{col 53}{text} {col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
{res}{txt}({res}est1{txt} stored)

{com}. eststo: reghdfe party_diff lholy_* if chamber == "upper" & year >= 2009 & year <= 2014 & votes >= 10, absorb(yrno ) cluster(state)
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 1 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}       114
{txt}Absorbing 1 HDFE group{col 51}F({res}   3{txt},{res}     29{txt}){col 67}= {res}      4.60
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0094
{txt}{col 51}R-squared{col 67}= {res}    0.2373
{txt}{col 51}Adj R-squared{col 67}= {res}    0.1792
{txt}{col 51}Within R-sq.{col 67}= {res}    0.2207
{txt}{col 1}Number of clusters ({res}state{txt}) {col 30}= {res}        30{txt}{col 51}Root MSE{col 67}= {res}    0.1289

{txt}{ralign 78:(Std. Err. adjusted for {res:30} clusters in state)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}  party_diff{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 5}lholy_B {c |}{col 14}{res}{space 2}-.1947338{col 26}{space 2} .0621501{col 37}{space 1}   -3.13{col 46}{space 3}0.004{col 54}{space 4} -.321845{col 67}{space 3}-.0676226
{txt}{space 5}lholy_G {c |}{col 14}{res}{space 2}-.0116673{col 26}{space 2}  .033578{col 37}{space 1}   -0.35{col 46}{space 3}0.731{col 54}{space 4}-.0803421{col 67}{space 3} .0570075
{txt}{space 4}lholy_NP {c |}{col 14}{res}{space 2} .2220233{col 26}{space 2} .0651774{col 37}{space 1}    3.41{col 46}{space 3}0.002{col 54}{space 4} .0887206{col 67}{space 3}  .355326
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .0257673{col 26}{space 2} .2444589{col 37}{space 1}    0.11{col 46}{space 3}0.917{col 54}{space 4}-.4742073{col 67}{space 3} .5257418
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}        yrno{col 14}{c |}{space 1}        6{col 27}{space 1}        0{col 39}{result}{space 1}        6{col 53}{text} {col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
{res}{txt}({res}est2{txt} stored)

{com}. eststo: reghdfe diffs lholy_* if chamber == "lower" , absorb(yrno ) cluster(state)
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 1 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}       392
{txt}Absorbing 1 HDFE group{col 51}F({res}   3{txt},{res}     48{txt}){col 67}= {res}     11.27
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0000
{txt}{col 51}R-squared{col 67}= {res}    0.4365
{txt}{col 51}Adj R-squared{col 67}= {res}    0.4202
{txt}{col 51}Within R-sq.{col 67}= {res}    0.4240
{txt}{col 1}Number of clusters ({res}state{txt}) {col 30}= {res}        49{txt}{col 51}Root MSE{col 67}= {res}    0.3876

{txt}{ralign 78:(Std. Err. adjusted for {res:49} clusters in state)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}       diffs{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 5}lholy_B {c |}{col 14}{res}{space 2}-.4256725{col 26}{space 2}  .147364{col 37}{space 1}   -2.89{col 46}{space 3}0.006{col 54}{space 4}-.7219678{col 67}{space 3}-.1293773
{txt}{space 5}lholy_G {c |}{col 14}{res}{space 2} .3026929{col 26}{space 2} .0779547{col 37}{space 1}    3.88{col 46}{space 3}0.000{col 54}{space 4} .1459543{col 67}{space 3} .4594314
{txt}{space 4}lholy_NP {c |}{col 14}{res}{space 2} .4336457{col 26}{space 2} .1786283{col 37}{space 1}    2.43{col 46}{space 3}0.019{col 54}{space 4} .0744894{col 67}{space 3}  .792802
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .1845968{col 26}{space 2} .6616029{col 37}{space 1}    0.28{col 46}{space 3}0.781{col 54}{space 4}-1.145645{col 67}{space 3} 1.514839
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}        yrno{col 14}{c |}{space 1}        9{col 27}{space 1}        0{col 39}{result}{space 1}        9{col 53}{text} {col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
{res}{txt}({res}est3{txt} stored)

{com}. eststo: reghdfe diffs lholy_* if chamber == "upper" , absorb(yrno ) cluster(state)
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 1 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}       395
{txt}Absorbing 1 HDFE group{col 51}F({res}   3{txt},{res}     49{txt}){col 67}= {res}      5.01
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0042
{txt}{col 51}R-squared{col 67}= {res}    0.2888
{txt}{col 51}Adj R-squared{col 67}= {res}    0.2683
{txt}{col 51}Within R-sq.{col 67}= {res}    0.2741
{txt}{col 1}Number of clusters ({res}state{txt}) {col 30}= {res}        50{txt}{col 51}Root MSE{col 67}= {res}    0.4379

{txt}{ralign 78:(Std. Err. adjusted for {res:50} clusters in state)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}       diffs{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 5}lholy_B {c |}{col 14}{res}{space 2}-.3287913{col 26}{space 2} .1650403{col 37}{space 1}   -1.99{col 46}{space 3}0.052{col 54}{space 4}-.6604521{col 67}{space 3} .0028696
{txt}{space 5}lholy_G {c |}{col 14}{res}{space 2} .2208459{col 26}{space 2}  .086279{col 37}{space 1}    2.56{col 46}{space 3}0.014{col 54}{space 4} .0474618{col 67}{space 3}   .39423
{txt}{space 4}lholy_NP {c |}{col 14}{res}{space 2} .4020013{col 26}{space 2} .1798948{col 37}{space 1}    2.23{col 46}{space 3}0.030{col 54}{space 4} .0404892{col 67}{space 3} .7635133
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .1124271{col 26}{space 2} .6120309{col 37}{space 1}    0.18{col 46}{space 3}0.855{col 54}{space 4}-1.117495{col 67}{space 3} 1.342349
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}        yrno{col 14}{c |}{space 1}        9{col 27}{space 1}        0{col 39}{result}{space 1}        9{col 53}{text} {col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
{res}{txt}({res}est4{txt} stored)

{com}. 
. //16. Create Table 8
. esttab , se label b(2) se (2) star(* 0.05 ** 0.01) replace tex
{res}
{c -(}
\def\sym#1{c -(}\ifmmode^{c -(}#1{c )-}\else\(^{c -(}#1{c )-}\)\fi{c )-}
\begin{c -(}tabular{c )-}{c -(}l*{c -(}4{c )-}{c -(}c{c )-}{c )-}
\hline\hline
                    &\multicolumn{c -(}1{c )-}{c -(}c{c )-}{c -(}(1){c )-}&\multicolumn{c -(}1{c )-}{c -(}c{c )-}{c -(}(2){c )-}&\multicolumn{c -(}1{c )-}{c -(}c{c )-}{c -(}(3){c )-}&\multicolumn{c -(}1{c )-}{c -(}c{c )-}{c -(}(4){c )-}\\
                    &\multicolumn{c -(}1{c )-}{c -(}c{c )-}{c -(}(mean) party\_diff{c )-}&\multicolumn{c -(}1{c )-}{c -(}c{c )-}{c -(}(mean) party\_diff{c )-}&\multicolumn{c -(}1{c )-}{c -(}c{c )-}{c -(}Distance between party medians (Shor McCarty 2015){c )-}&\multicolumn{c -(}1{c )-}{c -(}c{c )-}{c -(}Distance between party medians (Shor McCarty 2015){c )-}\\
\hline
Businesses (log)    &       -0.20\sym{c -(}**{c )-}&       -0.19\sym{c -(}**{c )-}&       -0.43\sym{c -(}**{c )-}&       -0.33        \\
                    &      (0.05)        &      (0.06)        &      (0.15)        &      (0.17)        \\
[1em]
Governments (log)   &       -0.02        &       -0.01        &        0.30\sym{c -(}**{c )-}&        0.22\sym{c -(}*{c )-} \\
                    &      (0.03)        &      (0.03)        &      (0.08)        &      (0.09)        \\
[1em]
Non-profits (log)   &        0.24\sym{c -(}**{c )-}&        0.22\sym{c -(}**{c )-}&        0.43\sym{c -(}*{c )-} &        0.40\sym{c -(}*{c )-} \\
                    &      (0.06)        &      (0.07)        &      (0.18)        &      (0.18)        \\
[1em]
Constant            &       -0.02        &        0.03        &        0.18        &        0.11        \\
                    &      (0.19)        &      (0.24)        &      (0.66)        &      (0.61)        \\
\hline
Observations        &         114        &         114        &         392        &         395        \\
\hline\hline
\multicolumn{c -(}5{c )-}{c -(}l{c )-}{c -(}\footnotesize Standard errors in parentheses{c )-}\\
\multicolumn{c -(}5{c )-}{c -(}l{c )-}{c -(}\footnotesize \sym{c -(}*{c )-} \(p<0.05\), \sym{c -(}**{c )-} \(p<0.01\){c )-}\\
\end{c -(}tabular{c )-}
{c )-}
{txt}
{com}. 
. //17. Limit the sample for party difference only to run the Granger tests
. drop if votes == . 
{txt}(682 observations deleted)

{com}. drop if year >= 2015
{txt}(45 observations deleted)

{com}. drop if year < 2009
{txt}(10 observations deleted)

{com}. 
. 
. //18. Collapse down to replicate the granger analysis
. 
. collapse (min) minvotes=votes (max) maxvotes=votes (firstnm) holy* lholy* (mean) party_diff [fweight=votes], by(state year1)
{txt}
{com}. 
. //19. Drop sessions with unusually low numbers of recorded votes
. replace party_diff = . if maxvotes < 10
{txt}(4 real changes made, 4 to missing)

{com}. 
. //20. Turn the data into a panel by using the Time Series commands (first transform strings to numeric)
. egen fips = group(state)
{txt}
{com}. egen yrno = group(year1)
{txt}
{com}. xtset fips yrno
{res}{txt}{col 8}panel variable:  {res}fips (unbalanced)
{txt}{col 9}time variable:  {res}{col 25}yrno, 1 to 6, but with gaps
{txt}{col 17}delta:  {res}1 unit
{txt}
{com}. 
. //21. Run a dummy regression to set the appropriate sample for every run
. reghdfe party_diff l(1/2).lholy_B, absorb(fips) cluster(state)
{res}{txt}(dropped 1 {browse "http://scorreia.com/research/singletons.pdf":singleton observations})
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 1 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}        59
{txt}Absorbing 1 HDFE group{col 51}F({res}   2{txt},{res}     22{txt}){col 67}= {res}      9.57
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0010
{txt}{col 51}R-squared{col 67}= {res}    0.9488
{txt}{col 51}Adj R-squared{col 67}= {res}    0.9127
{txt}{col 51}Within R-sq.{col 67}= {res}    0.1554
{txt}{col 1}Number of clusters ({res}state{txt}) {col 30}= {res}        23{txt}{col 51}Root MSE{col 67}= {res}    0.0387

{txt}{ralign 78:(Std. Err. adjusted for {res:23} clusters in state)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}  party_diff{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 5}lholy_B {c |}
{space 9}L1. {c |}{col 14}{res}{space 2} -.025896{col 26}{space 2} .0096434{col 37}{space 1}   -2.69{col 46}{space 3}0.014{col 54}{space 4}-.0458951{col 67}{space 3}-.0058969
{txt}{space 9}L2. {c |}{col 14}{res}{space 2}-.0681524{col 26}{space 2} .0156346{col 37}{space 1}   -4.36{col 46}{space 3}0.000{col 54}{space 4}-.1005765{col 67}{space 3}-.0357282
{txt}{space 12} {c |}
{space 7}_cons {c |}{col 14}{res}{space 2} .7344381{col 26}{space 2} .1410259{col 37}{space 1}    5.21{col 46}{space 3}0.000{col 54}{space 4} .4419683{col 67}{space 3} 1.026908
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}        fips{col 14}{c |}{space 1}       23{col 27}{space 1}       23{col 39}{result}{space 1}        0{col 53}{text}*{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
* = FE nested within cluster; treated as redundant for DoF computation
{res}{txt}
{com}. gen insampreg2 = e(sample)
{txt}
{com}. 
. //22. Relabel the independent variables
. label var lholy_B "Businesses (log)"
{txt}
{com}. label var lholy_NP "Non-profits (log)"
{txt}
{com}. label var lholy_G "Governments (log)"
{txt}
{com}. label var party_diff "Party Diff. (Avg.)"
{txt}
{com}. 
. 
. //22. Run the Granger Tests
. 
. eststo clear
{txt}
{com}. //Granger Tests FE
. local i = 1
{txt}
{com}. global yvar "party_diff"
{txt}
{com}. local xvars "lholy_N lholy_B lholy_G"
{txt}
{com}. foreach xvar of local xvars{c -(}
{txt}  2{com}.  eststo: reghdfe $yvar L(1/2).$yvar L(1/2).`xvar' if insampreg2 , absorb(yrno state) cluster(state)
{txt}  3{com}. testparm L(1/2).`xvar' 
{txt}  4{com}. di "test `i'"
{txt}  5{com}. local i = `i' + 1
{txt}  6{com}. {c )-}
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 4 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}        55
{txt}Absorbing 2 HDFE groups{col 51}F({res}   4{txt},{res}     20{txt}){col 67}= {res}      3.34
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0300
{txt}{col 51}R-squared{col 67}= {res}    0.9701
{txt}{col 51}Adj R-squared{col 67}= {res}    0.9379
{txt}{col 51}Within R-sq.{col 67}= {res}    0.3345
{txt}{col 1}Number of clusters ({res}state{txt}) {col 30}= {res}        21{txt}{col 51}Root MSE{col 67}= {res}    0.0329

{txt}{ralign 78:(Std. Err. adjusted for {res:21} clusters in state)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}  party_diff{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 2}party_diff {c |}
{space 9}L1. {c |}{col 14}{res}{space 2}-.1024023{col 26}{space 2} .0584138{col 37}{space 1}   -1.75{col 46}{space 3}0.095{col 54}{space 4}-.2242513{col 67}{space 3} .0194468
{txt}{space 9}L2. {c |}{col 14}{res}{space 2}   .26432{col 26}{space 2} .2296966{col 37}{space 1}    1.15{col 46}{space 3}0.263{col 54}{space 4}-.2148186{col 67}{space 3} .7434587
{txt}{space 12} {c |}
{space 4}lholy_NP {c |}
{space 9}L1. {c |}{col 14}{res}{space 2}-.0282278{col 26}{space 2} .0217968{col 37}{space 1}   -1.30{col 46}{space 3}0.210{col 54}{space 4} -.073695{col 67}{space 3} .0172395
{txt}{space 9}L2. {c |}{col 14}{res}{space 2} -.088046{col 26}{space 2} .0306025{col 37}{space 1}   -2.88{col 46}{space 3}0.009{col 54}{space 4}-.1518817{col 67}{space 3}-.0242104
{txt}{space 12} {c |}
{space 7}_cons {c |}{col 14}{res}{space 2} .8453761{col 26}{space 2} .2875375{col 37}{space 1}    2.94{col 46}{space 3}0.008{col 54}{space 4} .2455834{col 67}{space 3} 1.445169
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}        yrno{col 14}{c |}{space 1}        4{col 27}{space 1}        0{col 39}{result}{space 1}        4{col 53}{text} {col 54}{c |}
{res}{col 1}{text}       state{col 14}{c |}{space 1}       21{col 27}{space 1}       21{col 39}{result}{space 1}        0{col 53}{text}*{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
* = FE nested within cluster; treated as redundant for DoF computation
{res}{txt}({res}est1{txt} stored)

{p 0 7}{space 1}{text:( 1)}{space 1} {res}L.lholy_NP = 0{p_end}
{p 0 7}{space 1}{text:( 2)}{space 1} L2.lholy_NP = 0{p_end}

{txt}       F(  2,    20) ={res}    6.44
{txt}{col 13}Prob > F ={res}    0.0069
test 1
{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 4 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}        55
{txt}Absorbing 2 HDFE groups{col 51}F({res}   4{txt},{res}     20{txt}){col 67}= {res}      4.05
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0146
{txt}{col 51}R-squared{col 67}= {res}    0.9700
{txt}{col 51}Adj R-squared{col 67}= {res}    0.9377
{txt}{col 51}Within R-sq.{col 67}= {res}    0.3329
{txt}{col 1}Number of clusters ({res}state{txt}) {col 30}= {res}        21{txt}{col 51}Root MSE{col 67}= {res}    0.0330

{txt}{ralign 78:(Std. Err. adjusted for {res:21} clusters in state)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}  party_diff{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 2}party_diff {c |}
{space 9}L1. {c |}{col 14}{res}{space 2}-.1059552{col 26}{space 2} .0650715{col 37}{space 1}   -1.63{col 46}{space 3}0.119{col 54}{space 4} -.241692{col 67}{space 3} .0297816
{txt}{space 9}L2. {c |}{col 14}{res}{space 2} .2725098{col 26}{space 2} .2309127{col 37}{space 1}    1.18{col 46}{space 3}0.252{col 54}{space 4}-.2091656{col 67}{space 3} .7541852
{txt}{space 12} {c |}
{space 5}lholy_B {c |}
{space 9}L1. {c |}{col 14}{res}{space 2}-.0215254{col 26}{space 2} .0212437{col 37}{space 1}   -1.01{col 46}{space 3}0.323{col 54}{space 4} -.065839{col 67}{space 3} .0227882
{txt}{space 9}L2. {c |}{col 14}{res}{space 2}-.0851352{col 26}{space 2}  .032777{col 37}{space 1}   -2.60{col 46}{space 3}0.017{col 54}{space 4}-.1535069{col 67}{space 3}-.0167636
{txt}{space 12} {c |}
{space 7}_cons {c |}{col 14}{res}{space 2} .7786236{col 26}{space 2} .2956655{col 37}{space 1}    2.63{col 46}{space 3}0.016{col 54}{space 4} .1618761{col 67}{space 3} 1.395371
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}        yrno{col 14}{c |}{space 1}        4{col 27}{space 1}        0{col 39}{result}{space 1}        4{col 53}{text} {col 54}{c |}
{res}{col 1}{text}       state{col 14}{c |}{space 1}       21{col 27}{space 1}       21{col 39}{result}{space 1}        0{col 53}{text}*{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
* = FE nested within cluster; treated as redundant for DoF computation
{res}{txt}({res}est2{txt} stored)

{p 0 7}{space 1}{text:( 1)}{space 1} {res}L.lholy_B = 0{p_end}
{p 0 7}{space 1}{text:( 2)}{space 1} L2.lholy_B = 0{p_end}

{txt}       F(  2,    20) ={res}    7.50
{txt}{col 13}Prob > F ={res}    0.0037
test 2
{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 4 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}        55
{txt}Absorbing 2 HDFE groups{col 51}F({res}   4{txt},{res}     20{txt}){col 67}= {res}      4.17
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0128
{txt}{col 51}R-squared{col 67}= {res}    0.9707
{txt}{col 51}Adj R-squared{col 67}= {res}    0.9391
{txt}{col 51}Within R-sq.{col 67}= {res}    0.3475
{txt}{col 1}Number of clusters ({res}state{txt}) {col 30}= {res}        21{txt}{col 51}Root MSE{col 67}= {res}    0.0326

{txt}{ralign 78:(Std. Err. adjusted for {res:21} clusters in state)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}  party_diff{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 2}party_diff {c |}
{space 9}L1. {c |}{col 14}{res}{space 2}-.1283785{col 26}{space 2} .0592363{col 37}{space 1}   -2.17{col 46}{space 3}0.042{col 54}{space 4}-.2519432{col 67}{space 3}-.0048139
{txt}{space 9}L2. {c |}{col 14}{res}{space 2} .2752073{col 26}{space 2} .2567515{col 37}{space 1}    1.07{col 46}{space 3}0.297{col 54}{space 4}-.2603669{col 67}{space 3} .8107815
{txt}{space 12} {c |}
{space 5}lholy_G {c |}
{space 9}L1. {c |}{col 14}{res}{space 2}-.0153984{col 26}{space 2} .0123326{col 37}{space 1}   -1.25{col 46}{space 3}0.226{col 54}{space 4}-.0411238{col 67}{space 3}  .010327
{txt}{space 9}L2. {c |}{col 14}{res}{space 2}-.0402285{col 26}{space 2} .0134706{col 37}{space 1}   -2.99{col 46}{space 3}0.007{col 54}{space 4}-.0683277{col 67}{space 3}-.0121293
{txt}{space 12} {c |}
{space 7}_cons {c |}{col 14}{res}{space 2} .3586519{col 26}{space 2} .0759834{col 37}{space 1}    4.72{col 46}{space 3}0.000{col 54}{space 4} .2001533{col 67}{space 3} .5171504
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}        yrno{col 14}{c |}{space 1}        4{col 27}{space 1}        0{col 39}{result}{space 1}        4{col 53}{text} {col 54}{c |}
{res}{col 1}{text}       state{col 14}{c |}{space 1}       21{col 27}{space 1}       21{col 39}{result}{space 1}        0{col 53}{text}*{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
* = FE nested within cluster; treated as redundant for DoF computation
{res}{txt}({res}est3{txt} stored)

{p 0 7}{space 1}{text:( 1)}{space 1} {res}L.lholy_G = 0{p_end}
{p 0 7}{space 1}{text:( 2)}{space 1} L2.lholy_G = 0{p_end}

{txt}       F(  2,    20) ={res}    6.88
{txt}{col 13}Prob > F ={res}    0.0053
test 3
{txt}
{com}. 
. local xvar "party_diff"
{txt}
{com}. local yvars "lholy_N lholy_B lholy_G"
{txt}
{com}. foreach yvar of local yvars{c -(}
{txt}  2{com}.  eststo: reghdfe `yvar' L(1/2).`yvar' L(1/2).`xvar' if insampreg2, absorb(yrno state) cluster(state)
{txt}  3{com}. testparm L(1/2).`xvar' 
{txt}  4{com}. di "test `i'"
{txt}  5{com}. local i = `i' + 1
{txt}  6{com}. {c )-}
{res}{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 4 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}        55
{txt}Absorbing 2 HDFE groups{col 51}F({res}   4{txt},{res}     20{txt}){col 67}= {res}     33.80
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0000
{txt}{col 51}R-squared{col 67}= {res}    0.9444
{txt}{col 51}Adj R-squared{col 67}= {res}    0.8845
{txt}{col 51}Within R-sq.{col 67}= {res}    0.6021
{txt}{col 1}Number of clusters ({res}state{txt}) {col 30}= {res}        21{txt}{col 51}Root MSE{col 67}= {res}    0.2172

{txt}{ralign 78:(Std. Err. adjusted for {res:21} clusters in state)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}    lholy_NP{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 4}lholy_NP {c |}
{space 9}L1. {c |}{col 14}{res}{space 2} .1405639{col 26}{space 2} .0543501{col 37}{space 1}    2.59{col 46}{space 3}0.018{col 54}{space 4} .0271915{col 67}{space 3} .2539363
{txt}{space 9}L2. {c |}{col 14}{res}{space 2}-.7099487{col 26}{space 2} .0756871{col 37}{space 1}   -9.38{col 46}{space 3}0.000{col 54}{space 4}-.8678293{col 67}{space 3}-.5520681
{txt}{space 12} {c |}
{space 2}party_diff {c |}
{space 9}L1. {c |}{col 14}{res}{space 2} 3.153018{col 26}{space 2} 1.798248{col 37}{space 1}    1.75{col 46}{space 3}0.095{col 54}{space 4}-.5980618{col 67}{space 3} 6.904097
{txt}{space 9}L2. {c |}{col 14}{res}{space 2} .6726162{col 26}{space 2}  .758215{col 37}{space 1}    0.89{col 46}{space 3}0.386{col 54}{space 4}-.9089926{col 67}{space 3} 2.254225
{txt}{space 12} {c |}
{space 7}_cons {c |}{col 14}{res}{space 2} 9.007349{col 26}{space 2}  .659136{col 37}{space 1}   13.67{col 46}{space 3}0.000{col 54}{space 4} 7.632416{col 67}{space 3} 10.38228
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}        yrno{col 14}{c |}{space 1}        4{col 27}{space 1}        0{col 39}{result}{space 1}        4{col 53}{text} {col 54}{c |}
{res}{col 1}{text}       state{col 14}{c |}{space 1}       21{col 27}{space 1}       21{col 39}{result}{space 1}        0{col 53}{text}*{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
* = FE nested within cluster; treated as redundant for DoF computation
{res}{txt}({res}est4{txt} stored)

{p 0 7}{space 1}{text:( 1)}{space 1} {res}L.party_diff = 0{p_end}
{p 0 7}{space 1}{text:( 2)}{space 1} L2.party_diff = 0{p_end}

{txt}       F(  2,    20) ={res}    2.04
{txt}{col 13}Prob > F ={res}    0.1564
test 4
{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 4 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}        55
{txt}Absorbing 2 HDFE groups{col 51}F({res}   4{txt},{res}     20{txt}){col 67}= {res}     42.47
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0000
{txt}{col 51}R-squared{col 67}= {res}    0.9558
{txt}{col 51}Adj R-squared{col 67}= {res}    0.9081
{txt}{col 51}Within R-sq.{col 67}= {res}    0.5678
{txt}{col 1}Number of clusters ({res}state{txt}) {col 30}= {res}        21{txt}{col 51}Root MSE{col 67}= {res}    0.2141

{txt}{ralign 78:(Std. Err. adjusted for {res:21} clusters in state)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}     lholy_B{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 5}lholy_B {c |}
{space 9}L1. {c |}{col 14}{res}{space 2} .2766734{col 26}{space 2}  .080655{col 37}{space 1}    3.43{col 46}{space 3}0.003{col 54}{space 4}   .10843{col 67}{space 3} .4449168
{txt}{space 9}L2. {c |}{col 14}{res}{space 2}-.6001642{col 26}{space 2}  .067337{col 37}{space 1}   -8.91{col 46}{space 3}0.000{col 54}{space 4}-.7406266{col 67}{space 3}-.4597017
{txt}{space 12} {c |}
{space 2}party_diff {c |}
{space 9}L1. {c |}{col 14}{res}{space 2} 2.405878{col 26}{space 2} 1.708047{col 37}{space 1}    1.41{col 46}{space 3}0.174{col 54}{space 4}-1.157047{col 67}{space 3} 5.968802
{txt}{space 9}L2. {c |}{col 14}{res}{space 2} .2968022{col 26}{space 2}  .698463{col 37}{space 1}    0.42{col 46}{space 3}0.675{col 54}{space 4}-1.160166{col 67}{space 3}  1.75377
{txt}{space 12} {c |}
{space 7}_cons {c |}{col 14}{res}{space 2} 7.646687{col 26}{space 2} .6293318{col 37}{space 1}   12.15{col 46}{space 3}0.000{col 54}{space 4} 6.333924{col 67}{space 3} 8.959451
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}        yrno{col 14}{c |}{space 1}        4{col 27}{space 1}        0{col 39}{result}{space 1}        4{col 53}{text} {col 54}{c |}
{res}{col 1}{text}       state{col 14}{c |}{space 1}       21{col 27}{space 1}       21{col 39}{result}{space 1}        0{col 53}{text}*{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
* = FE nested within cluster; treated as redundant for DoF computation
{res}{txt}({res}est5{txt} stored)

{p 0 7}{space 1}{text:( 1)}{space 1} {res}L.party_diff = 0{p_end}
{p 0 7}{space 1}{text:( 2)}{space 1} L2.party_diff = 0{p_end}

{txt}       F(  2,    20) ={res}    1.50
{txt}{col 13}Prob > F ={res}    0.2474
test 5
{txt}({browse "http://scorreia.com/research/hdfe.pdf":MWFE estimator} converged in 4 iterations)
{res}
{txt}HDFE Linear regression{col 51}Number of obs{col 67}= {res}        55
{txt}Absorbing 2 HDFE groups{col 51}F({res}   4{txt},{res}     20{txt}){col 67}= {res}     73.44
{txt}Statistics robust to heteroskedasticity{col 51}Prob > F{col 67}= {res}    0.0000
{txt}{col 51}R-squared{col 67}= {res}    0.9228
{txt}{col 51}Adj R-squared{col 67}= {res}    0.8397
{txt}{col 51}Within R-sq.{col 67}= {res}    0.5626
{txt}{col 1}Number of clusters ({res}state{txt}) {col 30}= {res}        21{txt}{col 51}Root MSE{col 67}= {res}    0.4399

{txt}{ralign 78:(Std. Err. adjusted for {res:21} clusters in state)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}     lholy_G{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 5}lholy_G {c |}
{space 9}L1. {c |}{col 14}{res}{space 2} .3537642{col 26}{space 2} .1120849{col 37}{space 1}    3.16{col 46}{space 3}0.005{col 54}{space 4} .1199593{col 67}{space 3} .5875692
{txt}{space 9}L2. {c |}{col 14}{res}{space 2}-.4047753{col 26}{space 2} .0814157{col 37}{space 1}   -4.97{col 46}{space 3}0.000{col 54}{space 4}-.5746055{col 67}{space 3}-.2349451
{txt}{space 12} {c |}
{space 2}party_diff {c |}
{space 9}L1. {c |}{col 14}{res}{space 2} 6.167757{col 26}{space 2} 3.766068{col 37}{space 1}    1.64{col 46}{space 3}0.117{col 54}{space 4}-1.688123{col 67}{space 3} 14.02364
{txt}{space 9}L2. {c |}{col 14}{res}{space 2} -.899108{col 26}{space 2} 2.087568{col 37}{space 1}   -0.43{col 46}{space 3}0.671{col 54}{space 4}-5.253699{col 67}{space 3} 3.455483
{txt}{space 12} {c |}
{space 7}_cons {c |}{col 14}{res}{space 2} 3.400675{col 26}{space 2} .4688637{col 37}{space 1}    7.25{col 46}{space 3}0.000{col 54}{space 4} 2.422643{col 67}{space 3} 4.378708
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{txt}Absorbed degrees of freedom:
{res}{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 14}{hline 1}{c TRC}
{col 1}{text} Absorbed FE{col 14}{c |} Categories{col 27} - Redundant{col 39}  = Num. Coefs{col 54}{c |}
{res}{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 14}{hline 1}{c RT}
{col 1}{text}        yrno{col 14}{c |}{space 1}        4{col 27}{space 1}        0{col 39}{result}{space 1}        4{col 53}{text} {col 54}{c |}
{res}{col 1}{text}       state{col 14}{c |}{space 1}       21{col 27}{space 1}       21{col 39}{result}{space 1}        0{col 53}{text}*{col 54}{c |}
{res}{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 14}{hline 1}{c BRC}
* = FE nested within cluster; treated as redundant for DoF computation
{res}{txt}({res}est6{txt} stored)

{p 0 7}{space 1}{text:( 1)}{space 1} {res}L.party_diff = 0{p_end}
{p 0 7}{space 1}{text:( 2)}{space 1} L2.party_diff = 0{p_end}

{txt}       F(  2,    20) ={res}    1.43
{txt}{col 13}Prob > F ={res}    0.2628
test 6
{txt}
{com}. 
. //23: Table 4: F-tests and P-values are pulled from the above Stata Output. 
. 
. //24. Table 9: (see Table 4 instructions above for f-tests and p-values
. esttab, se label se(2) b(2) star( * 0.05) ///
> mtitles("DV: PD" "DV: PD" "DV: PD" "DV: NP" "DV: B" "DV: G")
{res}
{txt}{hline 104}
{txt}                              (1)           (2)           (3)           (4)           (5)           (6) 
{txt}                           DV: PD        DV: PD        DV: PD        DV: NP         DV: B         DV: G 
{txt}{hline 104}
{txt}L.Party Diff. (Avg.){res}        -0.10         -0.11         -0.13*         3.15          2.41          6.17 {txt}
                    {res} {ralign 12:{txt:(}0.06{txt:)}}  {ralign 12:{txt:(}0.07{txt:)}}  {ralign 12:{txt:(}0.06{txt:)}}  {ralign 12:{txt:(}1.80{txt:)}}  {ralign 12:{txt:(}1.71{txt:)}}  {ralign 12:{txt:(}3.77{txt:)}} {txt}

{txt}L2.Party Diff. (Av~){res}         0.26          0.27          0.28          0.67          0.30         -0.90 {txt}
                    {res} {ralign 12:{txt:(}0.23{txt:)}}  {ralign 12:{txt:(}0.23{txt:)}}  {ralign 12:{txt:(}0.26{txt:)}}  {ralign 12:{txt:(}0.76{txt:)}}  {ralign 12:{txt:(}0.70{txt:)}}  {ralign 12:{txt:(}2.09{txt:)}} {txt}

{txt}L.Non-profits (log) {res}        -0.03                                      0.14*                            {txt}
                    {res} {ralign 12:{txt:(}0.02{txt:)}}                              {ralign 12:{txt:(}0.05{txt:)}}                             {txt}

{txt}L2.Non-profits (log){res}        -0.09*                                    -0.71*                            {txt}
                    {res} {ralign 12:{txt:(}0.03{txt:)}}                              {ralign 12:{txt:(}0.08{txt:)}}                             {txt}

{txt}L.Businesses (log)  {res}                      -0.02                                      0.28*              {txt}
                    {res}               {ralign 12:{txt:(}0.02{txt:)}}                              {ralign 12:{txt:(}0.08{txt:)}}               {txt}

{txt}L2.Businesses (log) {res}                      -0.09*                                    -0.60*              {txt}
                    {res}               {ralign 12:{txt:(}0.03{txt:)}}                              {ralign 12:{txt:(}0.07{txt:)}}               {txt}

{txt}L.Governments (log) {res}                                    -0.02                                      0.35*{txt}
                    {res}                             {ralign 12:{txt:(}0.01{txt:)}}                              {ralign 12:{txt:(}0.11{txt:)}} {txt}

{txt}L2.Governments (log){res}                                    -0.04*                                    -0.40*{txt}
                    {res}                             {ralign 12:{txt:(}0.01{txt:)}}                              {ralign 12:{txt:(}0.08{txt:)}} {txt}

{txt}Constant            {res}         0.85*         0.78*         0.36*         9.01*         7.65*         3.40*{txt}
                    {res} {ralign 12:{txt:(}0.29{txt:)}}  {ralign 12:{txt:(}0.30{txt:)}}  {ralign 12:{txt:(}0.08{txt:)}}  {ralign 12:{txt:(}0.66{txt:)}}  {ralign 12:{txt:(}0.63{txt:)}}  {ralign 12:{txt:(}0.47{txt:)}} {txt}
{txt}{hline 104}
{txt}Observations        {res}           55            55            55            55            55            55 {txt}
{txt}{hline 104}
{txt}Standard errors in parentheses
{txt}* p<0.05

{com}. 
. 
. 
{txt}end of do-file

{com}. do "LAP_Replication_6_Table_7_Figure_4.do"
{txt}
{com}. //1. set this to the desired path
. cd "~/Desktop/LAP_PSRM_Replication/"
{res}/Users/garlicka/Desktop/LAP_PSRM_Replication
{txt}
{com}. 
. //2. Bring in the Garlick Replication data
. use "LAP_Replication_GarlickPlus_30states.dta", clear
{txt}
{com}. 
. //3. Limit the sample to the years with maximum coverage
. keep if year >= 2011 & year <= 2014
{txt}(68,007 observations deleted)

{com}. replace sg_vote = 4 if sg_vote == 5
{txt}(4,692 real changes made)

{com}. 
. //4. Create indicators for each state and then set their labels to the abbreviation
. replace state = upper(state)
{txt}(212,384 real changes made)

{com}. tab state, gen(st_)

      {txt}State {c |}
(abbreviati {c |}
        on) {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
         AK {c |}{res}        767        0.36        0.36
{txt}         AL {c |}{res}      6,491        3.06        3.42
{txt}         CA {c |}{res}     32,393       15.25       18.67
{txt}         CO {c |}{res}      5,825        2.74       21.41
{txt}         HI {c |}{res}     11,954        5.63       27.04
{txt}         IA {c |}{res}        570        0.27       27.31
{txt}         ID {c |}{res}      3,059        1.44       28.75
{txt}         IN {c |}{res}      3,485        1.64       30.39
{txt}         LA {c |}{res}      7,418        3.49       33.88
{txt}         MD {c |}{res}      9,080        4.28       38.16
{txt}         ME {c |}{res}      2,048        0.96       39.12
{txt}         MI {c |}{res}      5,364        2.53       41.65
{txt}         MN {c |}{res}      1,487        0.70       42.35
{txt}         MO {c |}{res}        230        0.11       42.46
{txt}         MS {c |}{res}      6,269        2.95       45.41
{txt}         MT {c |}{res}      9,162        4.31       49.72
{txt}         ND {c |}{res}      1,911        0.90       50.62
{txt}         NJ {c |}{res}      6,733        3.17       53.79
{txt}         NM {c |}{res}      1,880        0.89       54.68
{txt}         NY {c |}{res}     20,802        9.79       64.47
{txt}         OH {c |}{res}      2,182        1.03       65.50
{txt}         OK {c |}{res}      7,107        3.35       68.85
{txt}         PA {c |}{res}      6,167        2.90       71.75
{txt}         RI {c |}{res}      4,243        2.00       73.75
{txt}         TN {c |}{res}     13,678        6.44       80.19
{txt}         TX {c |}{res}         55        0.03       80.21
{txt}         UT {c |}{res}      9,041        4.26       84.47
{txt}         VA {c |}{res}     27,292       12.85       97.32
{txt}         WA {c |}{res}      4,626        2.18       99.50
{txt}         WI {c |}{res}      1,065        0.50      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}    212,384      100.00
{txt}
{com}. 
. label var st_1 "AK"
{txt}
{com}. label var st_2 "AL"
{txt}
{com}. label var st_3  "CA"
{txt}
{com}. label var st_4  "CO"
{txt}
{com}. label var st_5  "HI"
{txt}
{com}. label var st_6  "IA"
{txt}
{com}. label var st_7  "ID"
{txt}
{com}. label var st_8  "IN"
{txt}
{com}. label var st_9  "LA"
{txt}
{com}. label var st_10 "MD"
{txt}
{com}. label var st_11 "ME"
{txt}
{com}. label var st_12 "MI"
{txt}
{com}. label var st_13 "MN"
{txt}
{com}. label var st_14 "MO"
{txt}
{com}. label var st_15 "MS"
{txt}
{com}. label var st_16 "MT"
{txt}
{com}. label var st_17 "ND"
{txt}
{com}. label var st_18 "NJ"
{txt}
{com}. label var st_19 "NM"
{txt}
{com}. label var st_20 "NY"
{txt}
{com}. label var st_21 "OH"
{txt}
{com}. label var st_22 "OK"
{txt}
{com}. label var st_23 "PA"
{txt}
{com}. label var st_24 "RI"
{txt}
{com}. label var st_25 "TN"
{txt}
{com}. label var st_26 "TX"
{txt}
{com}. label var st_27 "UT"
{txt}
{com}. label var st_28 "VA"
{txt}
{com}. label var st_29 "WA"
{txt}
{com}. label var st_30 "WI"
{txt}
{com}. 
. //5. Set an indicator for the upper chamber
. gen upper = 0 
{txt}
{com}. replace upper = 1 if chamber == "upper"
{txt}(98,021 real changes made)

{com}. 
. //6. Run a regression to estimate the party difference of all those states. NOTE: These coefficients should be read in reference to the ommitted category (Alaska)
. eststo clear
{txt}
{com}. eststo: reg party_diff st_2-st_30 i.year i.sg_v i.upper

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}   212,383
{txt}{hline 13}{c +}{hline 34}   F(36, 212346)   = {res}   965.57
{txt}       Model {c |} {res} 3149.83667        36  87.4954632   {txt}Prob > F        ={res}    0.0000
{txt}    Residual {c |} {res} 19241.7597   212,346  .090615127   {txt}R-squared       ={res}    0.1407
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}    0.1405
{txt}       Total {c |} {res} 22391.5964   212,382  .105430763   {txt}Root MSE        =   {res} .30102

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}  party_diff{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 8}st_2 {c |}{col 14}{res}{space 2} .0274926{col 26}{space 2} .0115254{col 37}{space 1}    2.39{col 46}{space 3}0.017{col 54}{space 4} .0049031{col 67}{space 3}  .050082
{txt}{space 8}st_3 {c |}{col 14}{res}{space 2} .1673798{col 26}{space 2} .0110378{col 37}{space 1}   15.16{col 46}{space 3}0.000{col 54}{space 4} .1457461{col 67}{space 3} .1890136
{txt}{space 8}st_4 {c |}{col 14}{res}{space 2} .1652435{col 26}{space 2} .0115796{col 37}{space 1}   14.27{col 46}{space 3}0.000{col 54}{space 4} .1425478{col 67}{space 3} .1879392
{txt}{space 8}st_5 {c |}{col 14}{res}{space 2}-.0503099{col 26}{space 2} .0113425{col 37}{space 1}   -4.44{col 46}{space 3}0.000{col 54}{space 4}-.0725409{col 67}{space 3}-.0280789
{txt}{space 8}st_6 {c |}{col 14}{res}{space 2} .1624295{col 26}{space 2} .0167006{col 37}{space 1}    9.73{col 46}{space 3}0.000{col 54}{space 4} .1296968{col 67}{space 3} .1951623
{txt}{space 8}st_7 {c |}{col 14}{res}{space 2}-.0175928{col 26}{space 2} .0122065{col 37}{space 1}   -1.44{col 46}{space 3}0.150{col 54}{space 4}-.0415172{col 67}{space 3} .0063316
{txt}{space 8}st_8 {c |}{col 14}{res}{space 2} .1463465{col 26}{space 2} .0120175{col 37}{space 1}   12.18{col 46}{space 3}0.000{col 54}{space 4} .1227925{col 67}{space 3} .1699004
{txt}{space 8}st_9 {c |}{col 14}{res}{space 2}-.0495739{col 26}{space 2} .0114232{col 37}{space 1}   -4.34{col 46}{space 3}0.000{col 54}{space 4}-.0719631{col 67}{space 3}-.0271847
{txt}{space 7}st_10 {c |}{col 14}{res}{space 2} .0492795{col 26}{space 2} .0113243{col 37}{space 1}    4.35{col 46}{space 3}0.000{col 54}{space 4} .0270842{col 67}{space 3} .0714748
{txt}{space 7}st_11 {c |}{col 14}{res}{space 2} .4639892{col 26}{space 2} .0127563{col 37}{space 1}   36.37{col 46}{space 3}0.000{col 54}{space 4} .4389872{col 67}{space 3} .4889912
{txt}{space 7}st_12 {c |}{col 14}{res}{space 2}  .152501{col 26}{space 2} .0116291{col 37}{space 1}   13.11{col 46}{space 3}0.000{col 54}{space 4} .1297083{col 67}{space 3} .1752937
{txt}{space 7}st_13 {c |}{col 14}{res}{space 2} .3565661{col 26}{space 2} .0134594{col 37}{space 1}   26.49{col 46}{space 3}0.000{col 54}{space 4}  .330186{col 67}{space 3} .3829461
{txt}{space 7}st_14 {c |}{col 14}{res}{space 2} .0255344{col 26}{space 2} .0226465{col 37}{space 1}    1.13{col 46}{space 3}0.260{col 54}{space 4}-.0188521{col 67}{space 3}  .069921
{txt}{space 7}st_15 {c |}{col 14}{res}{space 2}-.0371061{col 26}{space 2} .0115227{col 37}{space 1}   -3.22{col 46}{space 3}0.001{col 54}{space 4}-.0596902{col 67}{space 3}-.0145219
{txt}{space 7}st_16 {c |}{col 14}{res}{space 2} .1965069{col 26}{space 2}  .011348{col 37}{space 1}   17.32{col 46}{space 3}0.000{col 54}{space 4} .1742651{col 67}{space 3} .2187488
{txt}{space 7}st_17 {c |}{col 14}{res}{space 2} .0551269{col 26}{space 2}   .01292{col 37}{space 1}    4.27{col 46}{space 3}0.000{col 54}{space 4} .0298039{col 67}{space 3} .0804498
{txt}{space 7}st_18 {c |}{col 14}{res}{space 2} .0533136{col 26}{space 2} .0115298{col 37}{space 1}    4.62{col 46}{space 3}0.000{col 54}{space 4} .0307155{col 67}{space 3} .0759117
{txt}{space 7}st_19 {c |}{col 14}{res}{space 2} .0333364{col 26}{space 2} .0129186{col 37}{space 1}    2.58{col 46}{space 3}0.010{col 54}{space 4} .0080163{col 67}{space 3} .0586565
{txt}{space 7}st_20 {c |}{col 14}{res}{space 2}-.0237748{col 26}{space 2} .0110966{col 37}{space 1}   -2.14{col 46}{space 3}0.032{col 54}{space 4}-.0455239{col 67}{space 3}-.0020258
{txt}{space 7}st_21 {c |}{col 14}{res}{space 2} .1410483{col 26}{space 2} .0126522{col 37}{space 1}   11.15{col 46}{space 3}0.000{col 54}{space 4} .1162503{col 67}{space 3} .1658463
{txt}{space 7}st_22 {c |}{col 14}{res}{space 2} .1086564{col 26}{space 2}  .011445{col 37}{space 1}    9.49{col 46}{space 3}0.000{col 54}{space 4} .0862245{col 67}{space 3} .1310883
{txt}{space 7}st_23 {c |}{col 14}{res}{space 2} .0219428{col 26}{space 2} .0115848{col 37}{space 1}    1.89{col 46}{space 3}0.058{col 54}{space 4}-.0007631{col 67}{space 3} .0446486
{txt}{space 7}st_24 {c |}{col 14}{res}{space 2} .0129988{col 26}{space 2} .0118213{col 37}{space 1}    1.10{col 46}{space 3}0.272{col 54}{space 4}-.0101706{col 67}{space 3} .0361682
{txt}{space 7}st_25 {c |}{col 14}{res}{space 2}-.0019235{col 26}{space 2} .0111894{col 37}{space 1}   -0.17{col 46}{space 3}0.864{col 54}{space 4}-.0238544{col 67}{space 3} .0200074
{txt}{space 7}st_26 {c |}{col 14}{res}{space 2} .0627169{col 26}{space 2} .0420423{col 37}{space 1}    1.49{col 46}{space 3}0.136{col 54}{space 4}-.0196849{col 67}{space 3} .1451188
{txt}{space 7}st_27 {c |}{col 14}{res}{space 2}-.0466076{col 26}{space 2} .0113443{col 37}{space 1}   -4.11{col 46}{space 3}0.000{col 54}{space 4}-.0688423{col 67}{space 3} -.024373
{txt}{space 7}st_28 {c |}{col 14}{res}{space 2}-.0632502{col 26}{space 2} .0110849{col 37}{space 1}   -5.71{col 46}{space 3}0.000{col 54}{space 4}-.0849763{col 67}{space 3} -.041524
{txt}{space 7}st_29 {c |}{col 14}{res}{space 2} .0908022{col 26}{space 2} .0117437{col 37}{space 1}    7.73{col 46}{space 3}0.000{col 54}{space 4} .0677848{col 67}{space 3} .1138197
{txt}{space 7}st_30 {c |}{col 14}{res}{space 2} .4482662{col 26}{space 2}  .014329{col 37}{space 1}   31.28{col 46}{space 3}0.000{col 54}{space 4} .4201818{col 67}{space 3} .4763507
{txt}{space 12} {c |}
{space 7}year1 {c |}
{space 7}2012  {c |}{col 14}{res}{space 2}-.0198549{col 26}{space 2} .0019375{col 37}{space 1}  -10.25{col 46}{space 3}0.000{col 54}{space 4}-.0236523{col 67}{space 3}-.0160575
{txt}{space 7}2013  {c |}{col 14}{res}{space 2}-.0255122{col 26}{space 2} .0018485{col 37}{space 1}  -13.80{col 46}{space 3}0.000{col 54}{space 4}-.0291352{col 67}{space 3}-.0218893
{txt}{space 7}2014  {c |}{col 14}{res}{space 2}-.0553748{col 26}{space 2} .0019265{col 37}{space 1}  -28.74{col 46}{space 3}0.000{col 54}{space 4}-.0591506{col 67}{space 3} -.051599
{txt}{space 12} {c |}
{space 5}sg_vote {c |}
{space 10}2  {c |}{col 14}{res}{space 2}-.0755986{col 26}{space 2} .0024292{col 37}{space 1}  -31.12{col 46}{space 3}0.000{col 54}{space 4}-.0803597{col 67}{space 3}-.0708376
{txt}{space 10}3  {c |}{col 14}{res}{space 2} .1771075{col 26}{space 2} .0042908{col 37}{space 1}   41.28{col 46}{space 3}0.000{col 54}{space 4} .1686977{col 67}{space 3} .1855172
{txt}{space 10}4  {c |}{col 14}{res}{space 2}-.0213885{col 26}{space 2} .0026836{col 37}{space 1}   -7.97{col 46}{space 3}0.000{col 54}{space 4}-.0266484{col 67}{space 3}-.0161287
{txt}{space 12} {c |}
{space 5}1.upper {c |}{col 14}{res}{space 2}-.0143572{col 26}{space 2} .0013385{col 37}{space 1}  -10.73{col 46}{space 3}0.000{col 54}{space 4}-.0169805{col 67}{space 3}-.0117338
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .2022138{col 26}{space 2} .0111605{col 37}{space 1}   18.12{col 46}{space 3}0.000{col 54}{space 4} .1803395{col 67}{space 3} .2240881
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}({res}est1{txt} stored)

{com}. 
. //7. Table 7
. esttab , se label b(2) se(2) nostar wide ///
> order(st_11 st_30 st_13 st_16 st_3 st_4 st_6 st_12 st_8 st_21 st_22 st_29 st_26 st_17 st_18 st_10 st_19 st_2 st_14 st_23 st_24 st_1 st_25 st_7 st_20 st_15 st_27 st_9 st_5   st_28   )
{res}
{txt}{hline 46}
{txt}                              (1)             
{txt}                     Party diff~e             
{txt}{hline 46}
{txt}ME                  {res}         0.46 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}WI                  {res}         0.45 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}MN                  {res}         0.36 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}MT                  {res}         0.20 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}CA                  {res}         0.17 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}CO                  {res}         0.17 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}IA                  {res}         0.16 {ralign 12:{txt:(}0.02{txt:)}}{txt}
{txt}MI                  {res}         0.15 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}IN                  {res}         0.15 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}OH                  {res}         0.14 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}OK                  {res}         0.11 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}WA                  {res}         0.09 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}TX                  {res}         0.06 {ralign 12:{txt:(}0.04{txt:)}}{txt}
{txt}ND                  {res}         0.06 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}NJ                  {res}         0.05 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}MD                  {res}         0.05 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}NM                  {res}         0.03 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}AL                  {res}         0.03 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}MO                  {res}         0.03 {ralign 12:{txt:(}0.02{txt:)}}{txt}
{txt}PA                  {res}         0.02 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}RI                  {res}         0.01 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}AK                  {res}                          {txt}
{txt}TN                  {res}        -0.00 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}ID                  {res}        -0.02 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}NY                  {res}        -0.02 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}MS                  {res}        -0.04 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}UT                  {res}        -0.05 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}LA                  {res}        -0.05 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}HI                  {res}        -0.05 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}VA                  {res}        -0.06 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}Year of Vote=2011   {res}         0.00 {ralign 12:{txt:(}.{txt:)}}{txt}
{txt}Year of Vote=2012   {res}        -0.02 {ralign 12:{txt:(}0.00{txt:)}}{txt}
{txt}Year of Vote=2013   {res}        -0.03 {ralign 12:{txt:(}0.00{txt:)}}{txt}
{txt}Year of Vote=2014   {res}        -0.06 {ralign 12:{txt:(}0.00{txt:)}}{txt}
{txt}Roll-call vote typ~1{res}         0.00 {ralign 12:{txt:(}.{txt:)}}{txt}
{txt}Roll-call vote typ~2{res}        -0.08 {ralign 12:{txt:(}0.00{txt:)}}{txt}
{txt}Roll-call vote typ~3{res}         0.18 {ralign 12:{txt:(}0.00{txt:)}}{txt}
{txt}Roll-call vote typ~4{res}        -0.02 {ralign 12:{txt:(}0.00{txt:)}}{txt}
{txt}upper=0             {res}         0.00 {ralign 12:{txt:(}.{txt:)}}{txt}
{txt}upper=1             {res}        -0.01 {ralign 12:{txt:(}0.00{txt:)}}{txt}
{txt}Constant            {res}         0.20 {ralign 12:{txt:(}0.01{txt:)}}{txt}
{txt}{hline 46}
{txt}Observations        {res}       212383             {txt}
{txt}{hline 46}
{txt}Standard errors in parentheses

{com}. 
. //8. Limit the sample to roll call votes
. gen votes = 1
{txt}
{com}. keep if sg_v == 2
{txt}(96,711 observations deleted)

{com}. 
. //9. Calculate the average party difference by state-year
. collapse (mean) party_diff (sum) votes, by(state year1)
{txt}
{com}. 
. //10. Merge in the Shor McCarty (2015) data
. replace state = upper(state)
{txt}(0 real changes made)

{com}. merge m:1 state year1 using "LAP_Replication_ShorMcCarty_50states.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}             347
{txt}{col 9}from master{col 30}{res}               0{txt}  (_merge==1)
{col 9}from using{col 30}{res}             347{txt}  (_merge==2)

{col 5}matched{col 30}{res}             103{txt}  (_merge==3)
{col 5}{hline 41}

{com}. 
. 
. //11. Calculate the averages of party difference and ideology for each states
. collapse (mean) party_diff *diffs, by(state)
{txt}
{com}. egen avgdiff = rowmean(h_diffs s_diffs)
{txt}
{com}. 
. //12. Figure 4
. twoway ///
> (scatter party_diff avgd, msymbol(none) mlabel(st) mcolor(gs1%60)) ///
> (lfit party_diff avgd), ///
> ytitle("Estimated Party Difference") xtitle("Distance in Party Medians (Shor McCarty 2015)") ///
> legend(order(2 "Fit"))
{res}{txt}
{com}. 
. 
{txt}end of do-file

{com}. do "LAP_Replication_7_Figure_5.do"
{txt}
{com}. //1. set this to the desired path
. cd "~/Desktop/LAP_PSRM_Replication/"
{res}/Users/garlicka/Desktop/LAP_PSRM_Replication
{txt}
{com}. 
. //2. Import the core replication file
. use "LAP_Replication_RCVs_US.dta", clear
{txt}
{com}. 
. //3. Only keep the passage votes
. //sg_votes: 1 = procedural, 2 = passage, 3 = amendment, 4 = committee
. keep if sg_vote == 2
{txt}(8,156 observations deleted)

{com}. 
. //4. Collapse this file down to find the average party difference of each chamber/congress
. collapse (mean) party_diff, by(congress chamber)
{txt}
{com}. 
. 
. //5. Bring in the congressional expenditures of different lobbying groups
. merge m:1 congress using "LAP_Replication_lobbyingexpenditures_US.dta", nogen
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}               0
{txt}{col 5}matched{col 30}{res}              16{txt}  
{col 5}{hline 41}

{com}. 
. //6. calculate correlations mentioned in the main text
. corr party_diff amount_12d_B amount_12d_G amount_12d_N totalamount if chamber ==  "house"
{txt}(obs=8)

             {c |} party_~f amount~B amount~G amount~N totala~t
{hline 13}{c +}{hline 45}
  party_diff {c |}{res}   1.0000
{txt}amount_12d_B {c |}{res}   0.4473   1.0000
{txt}amount_12d_G {c |}{res}   0.2007   0.5891   1.0000
{txt}amount_12d_N {c |}{res}   0.2381   0.9402   0.6832   1.0000
 {txt}totalamount {c |}{res}   0.4098   0.9961   0.6438   0.9639   1.0000

{txt}
{com}. corr party_diff amount_12d_B amount_12d_G amount_12d_N totalamount if chamber == "senate"
{txt}(obs=8)

             {c |} party_~f amount~B amount~G amount~N totala~t
{hline 13}{c +}{hline 45}
  party_diff {c |}{res}   1.0000
{txt}amount_12d_B {c |}{res}   0.7511   1.0000
{txt}amount_12d_G {c |}{res}   0.1497   0.5891   1.0000
{txt}amount_12d_N {c |}{res}   0.5629   0.9402   0.6832   1.0000
 {txt}totalamount {c |}{res}   0.7075   0.9961   0.6438   0.9639   1.0000

{txt}
{com}. 
. 
. //7. Transform the expenditures into Billions
. gen billz_N = amount_12d_N/1000000000
{txt}
{com}. gen billz_G = amount_12d_G/1000000000
{txt}
{com}. gen billz_B = amount_12d_B/1000000000
{txt}
{com}. 
. 
. //8. create the measures to be placed in stackable bar charts
. gen billz_N1 = billz_B + billz_G + billz_N
{txt}
{com}. gen billz_G1 = billz_B + billz_G
{txt}
{com}. 
. //9. Create the figure
. twoway ///
> (bar billz_N1 year , fcolor(maroon) lcolor(gs8) lwidth(thin) sort) ///
> (bar billz_G1 year , fcolor(dkgreen) lcolor(gs8) lwidth(thin) sort) ///
> (bar billz_B year , sort fcolor(navy) lcolor(gs8) lwidth(thin)) ///
> (line party_diff year if chamber == "house", sort yaxis(2) lcolor(black) lpattern(dash)) ///
> (line party_diff year if chamber == "senate", sort yaxis(2) lcolor(gs4) lpattern(solid)), ///
> ytitle("Lobbying Expenditures (2012$, billions)") ytitle("Average Party Difference on Passage votes", axis(2))  ylabel(0(.2).8, axis(2)) ///
> xtitle("Year") xlabel(1999(2)2014,angle(45)) ylabel(2(2)12, axis(1)) ///
> legend(order (3 "Business" 2 "Government" 1 "Non-Profit" 4 "House P.D." 5 "Senate P.D."))
{res}{txt}
{com}. 
. 
{txt}end of do-file

{com}. 
{txt}end of do-file

{com}. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}/Users/garlicka/Desktop/LAP_PSRM_Replication/Replication Log.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res} 6 Aug 2020, 11:44:10
{txt}{.-}
{smcl}
{txt}{sf}{ul off}